Introduction to C#

by anupmaurya
293 views

C# is the language at the heart of many Windows applications, including Windows Phone and Windows Store apps. It is the principal programming language for Microsoft and required knowledge for developers in this area.

C# development started at Microsoft in the late 1990s by a team led by Anders Hejlsberg. and his team within the .Net initiative and was approved by the European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO).

C# is a lot similar to Java syntactically and is easy for the users who have knowledge of C, C++ or Java.

What is C#?

C# is a general-purpose, multi-paradigm programming language encompassing static typing, strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines.

Why C#?

C# has many other reasons for being popular and in demand. Few of the reasons are mentioned below:
1.Easy to start: C# is a high-level language so it is closer to other popular programming languages like C, C++, and Java and thus becomes easy to learn for anyone.
2.Widely used for developing Desktop and Web Application: C# is widely used for developing web applications and Desktop applications. It is one of the most popular languages that is used in professional desktop. If anyone wants to create Microsoft apps, C# is their first choice.
3.Community:The larger the community the better it is as new tools and software will be developing to make it better. C# has a large community so the developments are done to make it exist in the system and not become extinct.
4.Game Development: C# is widely used in game development and will continue to dominate. C# integrates with Microsoft and thus has a large target audience. The C# features such as Automatic Garbage Collection, interfaces, object-oriented, etc. make C# a popular game developing language.

Advantages of C#

  • C# is very efficient in managing the system. All the garbage is automatically collected in C#.
  • There is no problem of memory leak in C# because of its high memory backup.
  • Cost of maintenance is less and is safer to run as compared to other languages.
  • C# code is compiled to a intermediate language (Common (.Net) Intermediate Language) which is a standard language, independently irrespective of the target operating system and architecture.

Disadvantages of C#

  • C# is less flexible as it depends alot on .Net framework.
  • C# runs slowly and program needs to be compiled each time when any changes are made.

Applications of C#

  • C# is widely used for developing desktop applications, web applications and web services.
  • It is used in creating applications of Microsoft at a large scale.
  • C# is also used in game development in Unity.

Program in C# to print Hello World

// C# program to print HelloWorld using System; namespace HelloWorld { class HelloWorld { // Main function static void Main(string[] args) { // Printing HelloWorld Console.WriteLine(" HelloWorld"); Console.ReadKey(); } } }
Code language: C# (cs)

Since the C# is developed within .Net framework initiative by Microsoft, it provides various IDEs to run C# programs: Microsoft Visual Studio, Visual Studio ExpressVisual Web Developer whereas In LinuxMono can be used to run C# programs on Linux.