C# Overview & Evolution of C# Language

    0 Votes


C# language was introduced by Microsoft in the middle of 2000 and it was developed by Anders Hejlsberg. It is an elegant and type-safe object oriented language which enables the developers to build the secure and robust applications which runs on .NET Framework.

C# is used to create traditional windows client applications, XML web services, client-server applications and many more. It is easy and simple to learn. The coding of c# language is same as to java. As it is objected oriented language it supports some of the features like encapsulation, inheritance and polymorphism.

Some features of C#:
  • Garbage Collection: It automatically reallocates the memory which is occupied by the unused objects.
  • Exception Handling: It provides a structured and extensible approach to detection and recovery.
  • It has a unified type system where all C# types includes primitive types like int and double which are inherit from single root object type.
C# Versions
  • C# 1.0 – It was the first release and was included in Visual Studio.Net.
  • C# 1.1 – It was released after the first release and Microsoft changed the Visual Studio to Visual Studio.Net 2003 in year 2003.
  • C# 2.0 – It was released in year 2005 as Visual Studio 2005. 
  • C# 3.0 – It was released with the same Visual Studio with the previous one and it was integrated with Windows Vista and Server 2008.
  • C# 3.5 – AJAX – Visual Studio 2008
  • C# 4.0 – It was released with the Visual Studio 2010.
  • C# 4.5 – It was released with the Visual Studio 2012.
  • C# 4.5.1, 4.5.2 – It is released with Visual Studio 2013.

 

Similarities between C# and Java

  • Both the languages are descended from C and C++.
  • They both have advanced features such as garbage collection.
  • They both are initially compiled to an intermediate language.

Differences between C# and Java are:

  • In C# there are primitive data types but not in Java.
  • In C# we can overload various operators but not in Java.

Let us have a look on simple program:

using System;
class Hello
{ static void Main ()
{
Console.WriteLine (“Hello, World”);
}
}
Output: Hello, World
  • In the first line we are using directive that reference the System namespace.
  • In the second the class name is initialized.
  • In the fourth line Main method is declared with the static modifier. It serves as the entry point of the program.
  • The WriteLine is the method of the Console Class.

Main method is the entry point of the program and the program can have a single entry point where control starts and ends. It is declared inside class or structure. It must be static but structure cannot be static. The Main method can be declared with or without parameters.

Platform Independent .NET (Mono/Portable)

Mono is an implementation of CLI (Common Language Infrastructure) and .NET Base Class Library (BCL) and also provides additional functionality. It is a dual licensed under free software and proprietary software license. It can be run on several operating systems such as Linux and Mac OS. It supports ASP.Net, ADO.Net, and Windows Forms Libraries for the wide range of applications and operating systems.

It has C# and VB.Net as compilers. Portable.Net provides implementation of the CLI, some portions of the BCL and a C# compiler. It also supports variety of CPUs and operating systems.