Intro to C# Programming Language

C# is a multi-paradigm, managed, object-oriented programming language created by Microsoft in conjunction with the .net framework. C# can also be used with non-Microsoft implementations (most notably, Mono ).

Versions

Versions 1.0/1.2 and 2.0 of C# were submitted and approved as both ECMA and ISO/IEC standards. However, as of August 2013, there are no ECMA or ISO/IEC specifications for C# 3.0, 4.0 and 5.0, however language specifications are available from Microsoft for C# 3.0 and C# 5.0 .

The language’s type system was originally static, with only explicit variable declarations allowed. However, the introduction of var (C# 3.0) and dynamic (C# 4.0) allow it to use type inference for implicit variable typing, and to consume dynamic type systems, respectively. Delegates (especially with lexical closure support for anonymous methods (C# 2.0) and lambda expressions (C# 3.0)) allow the language to be used for functional programming. C# 5.0 introduced the async and await keywords to simplify the use of asynchronous function calls.

Specifications

Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR). However, options like NGen (for the Microsoft .NET Framework) and AOT (for Mono) mean that C# code can be directly compiled into the native image. Additionally, some frameworks (e.g. the .NET Micro Framework) act as CIL interpreters, with no JIT.

Generics in C# are provided in part by the runtime, unlike C++ templates (templates are resolved at compile time), or Java’s generics (which use type-erasure).

With the combination of Microsoft .NET for Windows (desktop/server/mobile), Mono (desktop/server/mobile), Silverlight / Moonlight (browser/mobile), Compact Framework (mobile), and Micro Framework (embedded devices), it is available for a wide range of platforms.

Hello World Program in C#:


Output