Skip to main content
Removed content to make entry more concise. Removed most links in attempt to future proof it.
Source Link

C# is also available in non-Microsoft implementations (most notably, Mono).

Versions 1.0/1.2 and 2.0 of C# were submitted and approved as both ECMA and ISO/IEC standards. As of December 2010, there are no ECMA or ISO/IEC specifications for C# 3.0 and 4.0, however language specifications are available from Microsoft (3.0 and 4.0 respectively).

What is C#?

The language's typeC# is a multi-system was originally staticparadigm, with only explicit variable declarations allowed. Howevermanaged, the introduction of var (C# 3.0) and dynamic (C# 4.0) allow it to use type-inference for implicit variable typingstrongly typed, and to consume dynamic typegarbage-systemscollected, 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.

Compilation is usually to the Common Intermediate Language (CIL), which is then JIT-compiled to native code (and cached) during execution language created by Microsoft in conjunction with the Common Language Runtime (CLR); however, options like Ngen (.NET) and AOT (Mono) mean this isn't the only option. Additionally, some frameworks (e.g. the Micro Framework) act as CIL interpreters, platform; not to be confused with no JIT.

Perhaps unusually, generics in C# are provided (in part) by the runtime, unlike (for comparison) C++ templates,C or Java's generics (which use type-erasure).

With the combination of Microsoft C++.NET for Windows (desktop/server) C# supports imperative, Mono (desktop/server/mobile)declarative, Silverlight / Moonlight (browser/mobile)functional, Compact Framework (mobile)generic, and Micro Framework (embedded devices)object-oriented, itcomponent-oriented and meta programming disciplines. C# is also available for a wide range of platformsin non-Microsoft implementations.

Usage

In November 2014, Microsoft announced the decision to Open Source .NET with Apache 2.0 Open Source licensing and to begin supporting iOS, LinuxWhen you ask a question, and Android in additionbe sure to Windowsinclude any relevant source code as platforms for .NET 2015 (5.0) and ASP.NET 5.0. As a result C# can now target all these platforms using a single code base through Visual Studio 2015 (currently available for preview)minimal, complete, and verifiable example.

Hello World

using System;
class Hello
{
    static void Main() 
    {
        Console.WriteLine("Hello, World");
    }
}

FAQs on Stack Overflow

Resources If there are any compiler errors, be sure to indicate:

Books Because Unity has its own tag & uses its own version C#, you do not need to use the tag when asking general Unity questions.

Stack Exchange Resources

C# is also available in non-Microsoft implementations (most notably, Mono).

Versions 1.0/1.2 and 2.0 of C# were submitted and approved as both ECMA and ISO/IEC standards. As of December 2010, there are no ECMA or ISO/IEC specifications for C# 3.0 and 4.0, however language specifications are available from Microsoft (3.0 and 4.0 respectively).

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.

Compilation is usually to the Common Intermediate Language (CIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR); however, options like Ngen (.NET) and AOT (Mono) mean this isn't the only option. Additionally, some frameworks (e.g. the Micro Framework) act as CIL interpreters, with no JIT.

Perhaps unusually, generics in C# are provided (in part) by the runtime, unlike (for comparison) C++ templates, or Java's generics (which use type-erasure).

With the combination of Microsoft .NET for Windows (desktop/server), 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.

In November 2014, Microsoft announced the decision to Open Source .NET with Apache 2.0 Open Source licensing and to begin supporting iOS, Linux, and Android in addition to Windows as platforms for .NET 2015 (5.0) and ASP.NET 5.0. As a result C# can now target all these platforms using a single code base through Visual Studio 2015 (currently available for preview).

Hello World

using System;
class Hello
{
    static void Main() 
    {
        Console.WriteLine("Hello, World");
    }
}

FAQs on Stack Overflow

Resources

Books

What is C#?

C# is a multi-paradigm, managed, strongly typed, garbage-collected, programming language created by Microsoft in conjunction with the .NET platform; not to be confused with C or C++. C# supports imperative, declarative, functional, generic, object-oriented, component-oriented and meta programming disciplines. C# is also available in non-Microsoft implementations.

Usage

When you ask a question, be sure to include any relevant source code as a minimal, complete, and verifiable example. If there are any compiler errors, be sure to indicate:

  • Which compiler &/or IDE you are using, including its version.
  • Which C# language version you are using.
  • Exact error messages, including the lines on which they occur (mark those lines with comments)

Because Unity has its own tag & uses its own version C#, you do not need to use the tag when asking general Unity questions.

Stack Exchange Resources

In November 2014, Microsoft announced the decision to Open Source .NET with Apache 2.0 Open Source licensing and to begin supporting iOS, Linux, and Android in addition to Windows as platforms for .NET 2015 (5.0) and ASP.NET 5.0. As a result C# can now target all these platforms using a single code base through Visual Studio 2015 (currently available for preview).

Hello World

Books

In November 2014, Microsoft announced the decision to Open Source .NET with Apache 2.0 Open Source licensing and to begin supporting iOS, Linux, and Android in addition to Windows as platforms for .NET 2015 (5.0) and ASP.NET 5.0. As a result C# can now target all these platforms using a single code base through Visual Studio 2015 (currently available for preview).

Hello World

Books

C# is also available in non-Microsoft implementations (most notably, Mono).

Versions 1.0/1.2 and 2.0 of C# were submitted and approved as both ECMA and ISO/IEC standards. As of December 2010, there are no ECMA or ISO/IEC specifications for C# 3.0 and 4.0, however language specifications are available from Microsoft (3.0 and 4.0 respectively).

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.

Compilation is usually to the Common Intermediate Language (CIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR); however, options like Ngen (.NET) and AOT (Mono) mean this isn't the only option. Additionally, some frameworks (e.g. the Micro Framework) act as CIL interpreters, with no JIT.

Perhaps unusually, generics in C# are provided (in part) by the runtime, unlike (for comparison) C++ templates, or Java's generics (which use type-erasure).

With the combination of Microsoft .NET for Windows (desktop/server), 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

using System;
class Hello
{
    static void Main() 
    {
        Console.WriteLine("Hello, World");
    }
}

FAQs on Stack Overflow

Resources

C# is also available in non-Microsoft implementations (most notably, Mono).

Versions 1.0/1.2 and 2.0 of C# were submitted and approved as both ECMA and ISO/IEC standards. As of December 2010, there are no ECMA or ISO/IEC specifications for C# 3.0 and 4.0, however language specifications are available from Microsoft (3.0 and 4.0 respectively).

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.

Compilation is usually to the Common Intermediate Language (CIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR); however, options like Ngen (.NET) and AOT (Mono) mean this isn't the only option. Additionally, some frameworks (e.g. the Micro Framework) act as CIL interpreters, with no JIT.

Perhaps unusually, generics in C# are provided (in part) by the runtime, unlike (for comparison) C++ templates, or Java's generics (which use type-erasure).

With the combination of Microsoft .NET for Windows (desktop/server), 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

using System;
class Hello
{
    static void Main() 
    {
        Console.WriteLine("Hello, World");
    }
}

FAQs on Stack Overflow

Resources

Link
Loading