Previous Topic: Microsoft Visual StudioNext Topic: Common Language Runtime


C#

C# (pronounced C Sharp) is a new programming language created by Microsoft in the year 2000. It is a high level, strongly typed, object oriented language with similarities to C++ and Java. A C# source file has the .cs file extension, for example, hello.cs.

C# allows a namespace to be defined so that classes from different origins do not conflict. For example, CA could produce a class named Address. By declaring a namespace name when the class is defined (com.ca.gen), the effective class name becomes com.ca.gen.Address. This effective name would be unique even in the case of another company creating their own class named Address since both companies should have unique namespace names. The System namespace is a special namespace reserved to Microsoft.

In C# and other .NET-aware compilers, all strings are encoded in Unicode.

Rather than generating machine-specific object code, the output from the C# and other .NET-aware compilers is Microsoft intermediate language (MSIL). MSIL is a CPU-independent "assembly code" that will be converted to native machine code at runtime.

The C# and other .NET-aware compilers generally produce ready-for-execution assemblies rather than object modules that require link editing. An assembly may either be a DLL or an EXE. Assemblies may also contain resources, security, and versioning information.

In addition to assemblies, an application may have one or more configuration files. Configuration files are XML files that contain additional information about the application and the environment it executes within. Configuration files may specify information such as the private path or security settings and can be changed without recompiling the application.

The source C# or other .NET-aware code can be written to the Common Language Specification (CLS). This specification allows assemblies to be callable by any .NET-aware language. For example, following the specification allows a VB.NET application to invoke an assembly written in C#.