C# - Introduction

C# is a language for professional programming. C#(pronounced C sharp) is a programming language designed for building a wide range of enterprise applications that run on the .NET Framework . The goal of C# is to provide a simple, safe, modern, object-oriented, highperformance , robust and durable language for .NET development. Also it enables developers to build solutions for the broadest range of clients, including Web applications, Microsoft Windows Forms-based applications, and thin- and smart-client devices.

C# was developed by Anders Hejlsberg and his team during the development of .Net Framework .

The following reasons make C# a widely used professional language:

  • C# is a simple ,modern and object oriented programming language
  • It is easy to learn
  • C# is open source now
  • C# runs on Windows, Mac, and Linux
  • .NET includes a Common Execution engine and a rich class library.
  • C# can be used to build Windows client apps, Windows Store apps, iOS apps, and Android apps and can also be used to build backend and middle-tier frameworks and libraries.
  • It support garbage collection, automatic memory management,type safe and versioning control
  • The classes and data types are common to all of the .NET languages.
  • C# has been based according to the current trend and is very powerful and simple for building interoperable, scable, robust applications.

C# Language Evolution

C# is a much more powerful programming language than many of us may realize. Not only can you build traditional Windows Client applications and Web applications but you may also use C# to build mobile apps, Windows Store apps, and Enterprise applications.

The following table summarizes the C# versions with year and features.

1.01999-2002Modern, Object Oriented, Simple, Flexible, Typesafe, Managed, Garbage Collection, Cross-platform
2.02005Generics, Anonymous Method, Partial Class, Nullable Type
3.02008LINQ, Lamda Expression, Extension Method, Anonymous Type, Var
4.02010Named and Optional Parameters, Dynamic Binding
5.02012Async Programming,Caller Information
6.0 2014 Null-Conditional Operator,Auto-Property Initializers,Nameof Expressions,Primary Constructors

Where it is used?

C# language can be used to build any and all kinds of applications. Not only Windows or Web applications but C# can be used to build mobile, Windows Store, and Enterprise applications. C# can also be used within the SQL Server database to build reports, jobs and modules to do the backend work.

Figure : C# Applications Ecosystem

Application of C#

Windows Client Applications

Windows Forms and WPF are two major technologies used to develop Windows client applications. C# can also be used to write non-UI console and WPF Browser based applications. Visual Studio 2013 supports four project templates, including Windows Forms application, WPF application, Console application, and WPF Browser application.

Here are some common properties of Windows applications.

  • Windows applications run on a Microsoft Windows operating system.
  • Windows applications are typically executables (exes) and dynamic link libraries (DLLs).
  • Windows applications run on a PC and take all resources from the local machine.
  • Windows applications have a user interface with Windows controls such as buttons, menus, dialogs and forms/windows.

Examples of Windows Applications

  • Microsoft Office (Word, PowerPoint, Excel and so on)
  • Internet Explorer
  • Skype
  • Visual Studio 2012
  • Photoshop
  • SQL Server 2012
  • Paintbrush

Web Applications

ASP.NET was released on Jan 05, 2002. Since then, ASP.NET has become one of the most popular technologies to build web applications. ASP.NET can be combined with HTML, JavaScript and other libraries and APIs to build modern web applications

Visual Studio 2013/2015 supports the three major ASP.NET project templates, ASP.NET web applications, ASP.NET MVC web applications, and ASP.NET server controls.

The following are some common properties of Web applications:

  • Web applications run on a Web Server.
  • Web applications are typically hosted within an ASP.NET or HTML page.
  • Windows applications run on the server as well as in the client browser, depending on how the code is written. If C# is used as backend coding, the C# code runs on the server and the front end HTML runs within the client browser.
  • Web applications are accessed by users from outside of the physical premises of the application via a remote Internet connection and a browser.

The following are examples of Web sites:

  • msdn.com
  • bing.com
  • google.com
  • asp.net

ASP.NET MVC is one of the newest frameworks to build ASP.NET Web applications.

Windows and Web Services

Windows Services has been around since early Windows days. A Windows Service (also known as Microsoft Windows Service or Windows NT Service) is an executable application that runs on Windows operating systems. A service usually does not have a user interface, performs operations in the background and does not require any user interaction.

Web Services were introduced to provide remote communication among devices over the Internet. The main purpose of a Web Service is to provide data accessibility and updatability remotely using the internet protocols regardless of the platform, Operating System, client browser, and application. Physically, a web service is a software application running on a Web Server that can be called by outside applications using the internet to access and write data.

Windows Store Apps

Windows Store apps were introduced in the Windows 8 operating system. Windows Store apps are a new type of application that was never developed before. You can think of a Windows Store app as an app that runs on an iPhone or Android device and has features like Touch, messages, tiles, and swipe.

Mobile Apps

Mobile apps run on mobile devices. The Apple iOS and Google Android are two major players in the mobile app market. Microsoft has its own Mobile operating system, Windows Phone. Obviously, C# as a language is used to build Windows Phone apps.

But it does not mean you can't use the C# language to build iOS and Android apps. Xamarin has focused on building tools for C# developers that allow developers to build native apps for iOS and Android. Xamarin Studio works with Visual Studio to write code in C# and compiles come to native iOS and Android distributable.

Cloud and Azure

Visual Studio 2013/2015 with C# provides a complete suite of tools to build cloud based applications for Windows Azure. Windows Azure is Microsoft's operating system for cloud computing and hosting. Using Visual Studio, not only you can build Azure solutions but can also deploy and manage them. C# can also be used to work with SQL Azure, the cloud based version of Microsoft's SQL Server database server.

Enterprise Cross-Applications Development

The C# language may also be used cross-applications to connect and build enterprise solutions.

Some of the critical requirements of an enterprise architecture are connectivity with various types of applications to transfer data.