All Topics  
C Sharp

 
C Sharp

   Email Print
   Bookmark   Link






 

C Sharp



 
 
C# (pronounced C Sharp) is a multi-paradigm programming language
Multi-paradigm programming language

A multi-paradigm programming language is a programming language that supports more than one programming paradigm. As Lead designer Tim Budd holds it: The idea of a multiparadigm language is to provide a framework in which programmers can work in a variety of styles, freely intermixing constructs from different paradigms. The design goal...
 that encompasses functional
Functional programming

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of function s and avoids program state and immutable object data....
, imperative
Imperative programming

In computer science, imperative programming is a programming paradigm that describes computation in terms of statement s that change a program state ....
, generic
Generic programming

Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters and was pioneered by Ada which appeared in 1983....
, object-oriented
Object-oriented programming

Object-oriented programming is a programming paradigm that uses "Object_" and their interactions to design applications and computer programs....
 (class-based
Class (computer science)

In object-oriented programming, a class is a programming language construct that is used as a blueprint to create Object s. This blueprint includes Attribute s and Method s that the created objects all share....
), and component-oriented
Component-based software engineering

Component-based software engineering is a branch of the software engineering discipline, with emphasis on decomposition of the engineered systems into Functional programming or logical components with well-defined Interface used for communication across the components....
 programming disciplines. It was developed by Microsoft
Microsoft

Microsoft Corporation is a multinational corporation computer technology corporation that develops, manufactures, licenses, and supports a wide range of computer software products for computing devices....
 as part of the .NET initiative and later approved as a standard by ECMA
Ecma International

'Ecma International' is an international, private non-profit standards organization for information and communication systems. It acquired its name in 1994, when the European Computer Manufacturers Association changed its name to reflect the organization's international reach....
 (ECMA-334) and ISO
International Organization for Standardization

The International Organization for Standardization , widely known as ISO , is an international standard-setting body composed of representatives from various national standards organizations....
 (ISO/IEC 23270). C# is one of the programming languages supported by the .NET Framework
.NET Framework

The Microsoft .NET Framework is a software framework that is available with several Microsoft Windows operating systems. It includes a large Library of coded solutions to prevent common programming problems and a virtual machine that manages the execution of programs written specifically for the Software framework....
's Common Language Runtime
Common Language Runtime

The Common Language Runtime is a core component of Microsoft .NET Framework initiative. It is Microsoft's implementation of the Common Language Infrastructure standard, which defines an execution environment for program code....
.

C# is intended to be a simple, modern, general-purpose, object-oriented programming language.






Discussion
Ask a question about 'C Sharp'
Start a new discussion about 'C Sharp'
Answer questions from other users
Full Discussion Forum



Encyclopedia


C# (pronounced C Sharp) is a multi-paradigm programming language
Multi-paradigm programming language

A multi-paradigm programming language is a programming language that supports more than one programming paradigm. As Lead designer Tim Budd holds it: The idea of a multiparadigm language is to provide a framework in which programmers can work in a variety of styles, freely intermixing constructs from different paradigms. The design goal...
 that encompasses functional
Functional programming

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of function s and avoids program state and immutable object data....
, imperative
Imperative programming

In computer science, imperative programming is a programming paradigm that describes computation in terms of statement s that change a program state ....
, generic
Generic programming

Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters and was pioneered by Ada which appeared in 1983....
, object-oriented
Object-oriented programming

Object-oriented programming is a programming paradigm that uses "Object_" and their interactions to design applications and computer programs....
 (class-based
Class (computer science)

In object-oriented programming, a class is a programming language construct that is used as a blueprint to create Object s. This blueprint includes Attribute s and Method s that the created objects all share....
), and component-oriented
Component-based software engineering

Component-based software engineering is a branch of the software engineering discipline, with emphasis on decomposition of the engineered systems into Functional programming or logical components with well-defined Interface used for communication across the components....
 programming disciplines. It was developed by Microsoft
Microsoft

Microsoft Corporation is a multinational corporation computer technology corporation that develops, manufactures, licenses, and supports a wide range of computer software products for computing devices....
 as part of the .NET initiative and later approved as a standard by ECMA
Ecma International

'Ecma International' is an international, private non-profit standards organization for information and communication systems. It acquired its name in 1994, when the European Computer Manufacturers Association changed its name to reflect the organization's international reach....
 (ECMA-334) and ISO
International Organization for Standardization

The International Organization for Standardization , widely known as ISO , is an international standard-setting body composed of representatives from various national standards organizations....
 (ISO/IEC 23270). C# is one of the programming languages supported by the .NET Framework
.NET Framework

The Microsoft .NET Framework is a software framework that is available with several Microsoft Windows operating systems. It includes a large Library of coded solutions to prevent common programming problems and a virtual machine that manages the execution of programs written specifically for the Software framework....
's Common Language Runtime
Common Language Runtime

The Common Language Runtime is a core component of Microsoft .NET Framework initiative. It is Microsoft's implementation of the Common Language Infrastructure standard, which defines an execution environment for program code....
.

C# is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg
Anders Hejlsberg

Anders Hejlsberg is a prominent Denmark software engineer who co-designed several popular and commercially successful programming languages and development tools....
, the designer of Borland
Borland

Borland Software Corporation is a Computer software company headquartered in Austin, Texas. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn....
's Object Pascal
Object Pascal

Object Pascal refers to a branch of Object-oriented programming derivatives of Pascal , mostly known as the primary programming language of CodeGear Delphi....
 language. It has an object-oriented syntax
Syntax

In linguistics, syntax is the study of the principles and rules for constructing Sentence s in natural languages. In addition to referring to the discipline, the term syntax is also used to refer directly to the rules and principles that govern the sentence structure of any individual language, as in "the Irish syntax"....
 based on C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
 and is heavily influenced by Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
. It was initially named Cool, which stood for "C-like Object Oriented Language." However, in July 2000, when Microsoft
Microsoft

Microsoft Corporation is a multinational corporation computer technology corporation that develops, manufactures, licenses, and supports a wide range of computer software products for computing devices....
 made the project public, the name of the programming language was given as C#. The most recent version of the language is 3.0 which was released in conjunction with the .NET Framework
.NET Framework

The Microsoft .NET Framework is a software framework that is available with several Microsoft Windows operating systems. It includes a large Library of coded solutions to prevent common programming problems and a virtual machine that manages the execution of programs written specifically for the Software framework....
 3.5 in 2007. The next proposed version, 4.0, is in development.

Design goals

The ECMA standard lists these design goals for C#:
  • C# is intended to be a simple, modern, general-purpose, object-oriented programming language.
  • Because software robustness, durability and programmer productivity are important, the language should include strong type checking, array bounds checking
    Bounds checking

    In computer programming, bounds checking is any method of detecting whether a variable is within some bounds before its use. It is particularly relevant to a variable used as an index into an array to ensure its value lies within the bounds of the array....
    , detection of attempts to use uninitialized variables, source code portability
    Porting

    In computer science, porting is the process of adapting software so that an executable Computer program can be created for a computing environment that is different from the one for which it was originally designed ....
    , and automatic garbage collection
    Garbage collection (computer science)

    In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage , or memory used by Object that will never be accessed or mutated again by the Application software....
    .
  • The language is intended for use in developing software components that can take advantage of distributed environments.
  • Programmer portability is very important, especially for those programmers already familiar with C and C++.
  • Support for internationalization is very important.
  • C# is intended to be suitable for writing applications for both hosted and embedded system
    Embedded system

    An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints....
    s, ranging from the very large that use sophisticated operating system
    Operating system

    An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
    s, down to the very small having dedicated functions.
  • Although C# applications are intended to be economical with regard to memory and processing power
    Clock rate

    The clock rate is the fundamental rate in cycles per second for the frequency of the clock in any synchronous circuit. For example, a crystal oscillator frequency reference typically is synonymous with a fixed sinusoidal waveform, a clock rate is that frequency reference translated by electronic circuitry into a corresponding square wav...
     requirements, the language is not intended to compete directly on performance and size with C.


History

In 1996, Sun Microsystems
Sun Microsystems

Sun Microsystems, Inc. is a multinational corporation vendor of computers, computer components, computer software, and information technology services, founded on February 24, 1982....
 released the Java programming language with Microsoft soon purchasing a license to implement it in their operating system. Java was originally meant to be a platform independent language, but Microsoft, in their implementation, broke their license agreementand made a few changes that would essentially inhibit Java's platform-independent capabilities. Sun filed a lawsuit and Microsoft settled, deciding to create their own version of a partially compiled, partially interpreted object-oriented programming language with syntax closely related to that of C++.

During the development of .NET Framework, the class libraries
Base Class Library

The Base Class Library is a standard library available to all languages using the .NET Framework. .NET includes the BCL in order to encapsulate a large number of common functions, such as file reading and writing, graphic rendering, database interaction, and XML document manipulation, which makes the programmer's job easier....
 were originally written in a language/compiler called Simple Managed C (SMC). In January 1999, Anders Hejlsberg
Anders Hejlsberg

Anders Hejlsberg is a prominent Denmark software engineer who co-designed several popular and commercially successful programming languages and development tools....
 formed a team to build a new language at the time called Cool, which stood for "C like Object Oriented Language". Microsoft had considered keeping the name "Cool" as the final name of the language, but chose not to do so for trademark reasons. By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference
Professional Developers Conference

Microsoft's Professional Developers Conference is a conference for software developers, normally Microsoft Windows developers.It covers new and upcoming technology from Microsoft, and so only occurs in the years when there is something new to talk about....
, the language had been renamed C#, and the class libraries and ASP.NET
ASP.NET

ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services....
 runtime had been ported to C#.

C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg, who was previously involved with the design of Turbo Pascal
Turbo Pascal

Turbo Pascal is a complete software development system that includes a compiler and an Integrated Development Environment for the Pascal programming language running under CP/M, CP/M-86, and MS-DOS, developed by Borland under Philippe Kahn's leadership....
, Borland Delphi, and Visual J++
Visual J++

Visual J++ was Microsoft's specific implementation of Java . Optimized for the Microsoft Windows, J++ programs could only run on the MSJVM , which was Microsoft's attempt at a faster Interpreter ....
. In interviews and technical papers he has stated that flaws in most major programming languages (e.g. C++, Java, Delphi, and Smalltalk
Smalltalk

Smalltalk is an Object-oriented programming, Type system, reflection computer programming programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human?computer symbiosis." It was designed and created in part for educational use, more so for constructionist learning, at PARC by Al...
) drove the fundamentals of the Common Language Runtime
Common Language Runtime

The Common Language Runtime is a core component of Microsoft .NET Framework initiative. It is Microsoft's implementation of the Common Language Infrastructure standard, which defines an execution environment for program code....
 (CLR), which, in turn, drove the design of the C# programming language itself. Some argue that C# shares roots in other languages..

Features

Note: The following description is based on the language standard and other documents listed in the external links section.


By design, C# is the programming language that most directly reflects the underlying Common Language Infrastructure
Common Language Infrastructure

The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
 (CLI). Most of its intrinsic types correspond to value-types implemented by the CLI framework. However, the language specification does not state the code generation requirements of the compiler: that is, it does not state that a C# compiler must target a Common Language Runtime, or generate Common Intermediate Language
Common Intermediate Language

Common Intermediate Language is the lowest-level human-readable programming language in the Common Language Infrastructure and in the .NET Framework....
 (CIL), or generate any other specific format. Theoretically, a C# compiler could generate machine code like traditional compilers of C++ or FORTRAN. However, in practice, all existing compiler implementations target CIL.

Some notable C# distinguishing features are:

  • There are no global variables or functions. All methods and members must be declared within classes. It is possible, however, to use static methods/variables within public classes instead of global variables/functions.
  • Local variables cannot shadow variables of the enclosing block, unlike C and C++. Variable shadowing
    Variable shadowing

    In computer programming, variable shadowing occurs when a variable declared within a method or inner class has the same name as a variable declared in an outer class....
     is often considered confusing by C++ texts.
  • C# supports a strict Boolean datatype
    Boolean datatype

    In computer science, the Boolean algebra datatype, sometimes called the logical datatype, is a primitive datatype having one of two values: Truth value and false....
    , bool. Statements that take conditions, such as while and if, require an expression of a boolean type. While C++ also has a boolean type, it can be freely converted to and from integers, and expressions such as if(a) require only that a is convertible to bool, allowing a to be an int, or a pointer. C# disallows this "integer meaning true or false" approach on the grounds that forcing programmers to use expressions that return exactly bool can prevent certain types of programming mistakes such as if (a = b) (use of = instead of

).
  • In C#, memory address pointers can only be used within blocks specifically marked as unsafe, and programs with unsafe code need appropriate permissions to run. Most object access is done through safe object references, which are always either pointing to a valid, existing object, or have the well-defined null value; a reference to a garbage-collected object, or to random block of memory, is impossible to obtain. An unsafe pointer can point to an instance of a value-type, array, string, or a block of memory allocated on a stack. Code that is not marked as unsafe can still store and manipulate pointers through the System.IntPtr type, but cannot dereference them.
  • Managed memory cannot be explicitly freed, but is automatically garbage collected. Garbage collection addresses memory leak
    Memory leak

    In computer science, a memory leak is a particular type of unintentional memory consumption by a computer program where the program fails to release dynamic memory when no longer needed....
    s. C# also provides direct support for deterministic finalization with the using statement (supporting the Resource Acquisition Is Initialization
    Resource Acquisition Is Initialization

    Resource Acquisition Is Initialization, often referred to by the acronym RAII, is a popular design pattern in several Object-oriented_programming_language like C++, D and Ada ....
     idiom).
  • Multiple inheritance
    Multiple inheritance

    Multiple inheritance refers to a feature of some object-oriented programming programming languages in which a class can inheritance behaviors and features from more than one superclass ....
     is not supported, although a class can implement any number of interfaces. This was a design decision by the language's lead architect to avoid complication, avoid dependency hell
    Dependency hell

    Dependency hell is a colloquial term for the frustration of some software users who have installed Software package which have dependency on specific Software versionings of other software packages....
     and simplify architectural requirements throughout CLI.
  • C# is more typesafe than C++. The only implicit conversions by default are those which are considered safe, such as widening of integers and conversion from a derived type to a base type. This is enforced at compile-time, during JIT
    Just-in-time compilation

    In computing, just-in-time compilation , also known as dynamic translation, is a technique for improving the runtime performance of a computer program....
    , and, in some cases, at runtime. There are no implicit conversions between booleans and integers, nor between enumeration members and integers (except for literal 0, which can be implicitly converted to any enumerated type). Any user-defined conversion must be explicitly marked as explicit or implicit, unlike C++ copy constructor
    Copy constructor

    A copy constructor is a special Constructor in the C++ programming language used to create a new Object Object copy of an existing object. This constructor takes a single...
    s and conversion operators, which are both implicit by default.
  • Enumeration
    Enumerated type

    In computer programming, an enumerated type is a data type consisting of a set of named constants called enumerators. The act of creating an enumerated type defines an enumeration....
     members are placed in their own scope
    Scope (programming)

    In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes....
    .
  • C# provides syntactic sugar
    Syntactic sugar

    Syntactic sugar is a term coined by Peter J. Landin for additions to the syntax of a computer language that do not affect its Function but make it "sweeter" for humans to use....
     for a common pattern of a pair of methods, accessor (getter) and mutator (setter)
    Mutator method

    In computer science, a mutator method is a method used to control changes to a variable.The mutator method, sometimes called a "setter", is most often used in object-oriented programming, in keeping with the principle of encapsulation ....
     encapsulating operations on a single attribute
    Attribute (computing)

    In computing, an attribute is a specification that defines a property of an object, element, or file. An attribute of an object usually consists of a name and a value; of an element, a type or class name; of a file, a name and extension....
     of a class, in the form of properties
    Property (programming)

    In some object-oriented programming programming languages, a property is a special sort of Class member, intermediate between a field and a method ....
    .
  • Full type reflection
    Reflection (computer science)

    In computer science, reflection is the process by which a computer program can observe and modify its own structure and behaviour. The programming paradigm driven by reflection is called reflective programming....
     and discovery is available.
  • C# currently (as of 3 June 2008) has 77 reserved word
    Reserved word

    Reserved words are one type of grammatical construct in programming languages. These words have special meaning within the language and are predefined in the language?s formal specifications....
    s.


Common Type system (CTS)

C# has a unified type system. This unified type system is called Common Type System
Common Type System

The Common Type System is a standard that specifies how Type definitions and specific values of Types are represented in computer memory. It is intended to allow programs written in different programming languages to easily share information....
 (CTS)
.

A unified type system implies that all types, including primitives such as integers, are subclasses of the System.Object class. For example, every type inherits a ToString method. For performance reasons, primitive types (and value types in general) are internally allocated on the stack
Stack-based memory allocation

Stack s in computing architectures are regions of memory where data is added or removed in a LIFO manner.In most modern computer systems, each Thread has a reserved region of memory referred to as its stack....
.

Categories of datatypes

CTS separates datatypes into two categories:

  1. Value types
  2. Reference types


Value types are plain aggregations of data. Instances of value types do not have referential identity nor a referential comparison semantics - equality and inequality comparisons for value types compare the actual data values within the instances, unless the corresponding operators are overloaded. Value types are derived from System.ValueType, always have a default value, and can always be created and copied. Some other limitations on value types are that they cannot derive from each other (but can implement interfaces) and cannot have a default (parameterless) constructor. Examples of value types are some primitive types, such as int (a signed 32-bit integer), float (a 32-bit IEEE floating-point number), char (a 16-bit Unicode codepoint), and System.DateTime (identifies a specific point in time with millisecond precision).

In contrast, reference types have the notion of referential identity - each instance of reference type is inherently distinct from every other instance, even if the data within both instances is the same. This is reflected in default equality and inequality comparisons for reference types, which test for referential rather than structural equality, unless the corresponding operators are overloaded (such as the case for System.String). In general, it is not always possible to create an instance of a reference type, nor to copy an existing instance, or perform a value comparison on two existing instances, though specific reference types can provide such services by exposing a public constructor or implementing a corresponding interface (such as ICloneable or IComparable). Examples of reference types are object (the ultimate base class for all other C# classes), System.String (a string of Unicode characters), and System.Array (a base class for all C# arrays).

Both type categories are extensible with user-defined types.

Boxing and unboxing

Boxing is the operation of converting a value of a value type into a value of a corresponding reference type.

Example: int foo = 42; // Value type... object bar = foo; // foo is boxed to bar.

Unboxing is the operation of converting a value of a reference type (previously boxed) into a value of a value type.

Example: int foo = 42; // Value type. object bar = foo; // foo is boxed to bar. int foo2 = (int)bar; // Unboxed back to value type.

Features of C# 2.0

New features in C# 2.0 (corresponding to the 3rd edition of the ECMA-334 standard and the .NET Framework 2.0) are:

Partial class

Partial classes allow implementation of a class to be spread between several files, with each file containing one or more class members. It is primarily useful when parts of a class are automatically generated. For example, the feature is heavily used by code-generating user interface designers in Visual Studio.

file1.cs:

public partial class MyClass



file2.cs:

public partial class MyClass



Generics

Generics
Generic programming

Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters and was pioneered by Ada which appeared in 1983....
, or parameterized types, or parametric polymorphism
Polymorphism in object-oriented programming

In simple terms, polymorphism is the ability of one type, A, to appear as and be used like another type, B. In strongly typed languages, this usually means that type A somehow derives from type B, or type A implements an interface that represents type B....
 is a .NET 2.0 feature supported by C#. Unlike C++ templates, .NET parameterized types are instantiated at runtime rather than by the compiler; hence they can be cross-language whereas C++ templates cannot. They support some features not supported directly by C++ templates such as type constraints on generic parameters by use of interfaces. On the other hand, C# does not support non-type generic parameters. Unlike generics in Java, .NET generics use reification
Reification (computer science)

Reification is a process through which a computable/addressable object - a resource - is created in a system, as a proxy for a non computable/addressable object....
 to make parameterized types first-class objects in the CLI
Common Language Infrastructure

The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
 Virtual Machine, which allows for optimizations and preservation of the type information.

Static classes

Static classes are classes that cannot be instantiated or inherited from, and that only allow static members. Their purpose is similar to that of modules in many procedural languages.

A new form of iterator providing generator functionality

A new form of iterator
Iterator

In computer science, an iterator is an object that allows a programmer to traverse through all the elements of a Collection , regardless of its specific implementation....
 that provides generator
Generator (computer science)

In computer science, a generator is a special subroutine that can be used to control the iteration behaviour of a control flow#Loops. A generator is very similar to a function that returns an array, in that a generator has parameters, can be called, and generates a sequence of values....
 functionality, using a yield return construct similar to yield in Python
Python syntax and semantics

The syntax of the Python is the set of rules that defines how a Python program will be written and interpreted . Python was designed to be a highly readable language....
.

// Method that takes an iterable input (possibly an array) // and returns all even numbers. public static IEnumerable GetEven(IEnumerable numbers)



Anonymous delegates

Anonymous delegates provide closure
Closure (computer science)

In computer science, a closure is a function that is evaluated in an environment containing one or more bound variables. When called, the function can access these variables....
 functionality in C#. Code inside the body of an anonymous delegate has full read/write access to local variables, method parameters, and class members in scope of the delegate, excepting out and ref parameters. For example:-

int SumOfArrayElements(int[] array)



Delegate covariance and contravariance

Conversions from method groups to delegate types
Delegate (.NET)

A delegate is a form of Type safety function pointer used by the .NET Framework. Delegates specify a Method to call and optionally an Object to call the method on....
 are covariant and contravariant
Covariance and contravariance (computer science)

Within the type system of a programming language, an operator from types to types is covariant if it preserves the subtype, which orders types from more specific ones to more generic ones; it is contravariant if it reverses this ordering....
 in return and parameter types, respectively.

The accessibility of property accessors can be set independently

Example:

string status = string.Empty;

public string Status



Nullable types

Nullable value types
Nullable Types

In programming, nullable type is a feature of some programming languages which allows a data type to be set to Null instead of their common range of possible values....
 (denoted by a question mark, e.g. int? i = null;) which add null to the set of allowed values for any value type. This provides improved interaction with SQL databases, which can have nullable columns of types corresponding to C# primitive types: an SQL INTEGER NULL column type directly translates to the C# int?.

Nullable types received an eleventh-hour
The Eleventh Hour

The eleventh hour is an expression referring to the last moments before a deadline or the imminence of a decisive or "final" moment. Usage of this term may be traced back to the Parable of the Workers in the Vineyard in the Gospel of Matthew....
 improvement at the end of August 2005, mere weeks before the official launch, to improve their boxing characteristics: a nullable variable which is assigned null is not actually a null reference, but rather an instance of struct Nullable with property HasValue equal to false. When boxed, the Nullable instance itself is boxed, and not the value stored in it, so the resulting reference would always be non-null, even for null values. The following code illustrates the corrected flaw:

int? i = null; object o = i; if (o null) Console.WriteLine("Correct behaviour - runtime version from September 2005 or later"); else Console.WriteLine("Incorrect behaviour - pre-release runtime (from before September 2005)");

When copied into objects, the official release boxes values from Nullable instances, so null values and null references are considered equal. The late nature of this fix caused some controversy , since it required core-CLR
Common Language Runtime

The Common Language Runtime is a core component of Microsoft .NET Framework initiative. It is Microsoft's implementation of the Common Language Infrastructure standard, which defines an execution environment for program code....
 changes affecting not only .NET2, but all dependent technologies (including C#, VB, SQL Server 2005 and Visual Studio 2005).

Null-Coalesce operator

The ?? operator is called the null-coalescing operator and is used to define a default value for a nullable value types as well as reference types. It returns the left-hand operand if it is not null; otherwise it returns the right operand.

object nullObj = null; object obj = new Object; return nullObj ?? obj; // returns obj

The primary use of this operator is to assign a nullable type to a non-nullable type with an easy syntax:

int? i = null; int j = i ?? 0; // If i is not null, initialize j to i. Else (if i is null), initialize j to 0.

Features of C# 3.0

C# 3.0 was released on 19 November 2007 as part of .NET Framework 3.5. It includes new features inspired by functional programming
Functional programming

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of function s and avoids program state and immutable object data....
 languages such as Haskell
Haskell (programming language)

Haskell is a standardized, purely functional programming language with non-strict programming language, named after logician Haskell Curry. The goals of the language are described as:...
 and ML, and is driven largely by the introduction of the Language Integrated Query
Language Integrated Query

Language Integrated Query is a Microsoft .NET Framework component that adds native data Query language capabilities to List of .NET languages....
 (LINQ) pattern to the Common Language Runtime. It is not currently standardized by any standards organisation.

LINQ (Language-Integrated Query)

LINQ
LINQ

LINQ is a word-based card game from Endless Games, introduced at the American International Toy Fair in 2005.Gameplay requires at least four Player s, two of which are dealt cards with the same word, while the others receive blanks....
 is an extensible, general-purpose query language for many kinds of data sources (including plain object collections, XML documents, databases, and so on) which is tightly integrated with other C# language facilities. The syntax heavily borrows from SQL. An example:

int[] array = ;

// Select squares of all odd numbers in the array sorted in descending order IEnumerable query = from x in array where x % 2

1 orderby x descending select x * x; // Result: 49, 25, 1

Object initializers

Customer c = new Customer; c.Name = "James";

can be written

Customer c = new Customer ;

Collection initializers

MyList list = new MyList; list.Add(1); list.Add(2); can be written as MyList list = new MyList ; assuming that MyList implements System.Collections.IEnumerable and has a public Add method

Anonymous types

var x = new ;

Local variable type inference

Local variable type inference
Type inference

Type inference, or implicit typing, refers to the ability to deduce automatically the type of a value in a programming language. It is a feature present in some strongly-typed programming language static typing#Static and dynamic typing languages....
: var x = new Dictionary>; is interchangeable with Dictionary> x = new Dictionary>; This feature is not just a convenient syntactic sugar
Syntactic sugar

Syntactic sugar is a term coined by Peter J. Landin for additions to the syntax of a computer language that do not affect its Function but make it "sweeter" for humans to use....
 for shorter local variable declarations, but it is also required for the declaration of variables of anonymous types.

Lambda expressions

Lambda
Closure (computer science)

In computer science, a closure is a function that is evaluated in an environment containing one or more bound variables. When called, the function can access these variables....
 expressions provide a concise way to write first-class anonymous function values. Compare the following C# 2.0 snippet:

listOfFoo.Where(delegate(Foo x) )

with this C# 3.0 equivalent:

listOfFoo.Where(x => x.Size > 10);

In the above examples, lambda expressions are merely short-hand syntax for anonymous delegates with type inference for parameters and return type. However, depending on the context they are used in, a C# compiler can also transform lambdas into ASTs
Abstract syntax tree

In computer science, an abstract syntax tree , or just syntax tree, is a directed tree representation of the abstract syntactic structure of source code written in a certain programming language....
 that can then be processed at run-time. In the example above, if listOfFoo is not a plain in-memory collection, but a wrapper around a database table, it could use this technique to translate the body of the lambda into the equivalent SQL expression for optimized execution. Either way, the lambda expression itself looks exactly the same in the code, so the way it is used at run-time is transparent to the client.

Automatic properties

The compiler will generate a private instance variable and the appropriate accessor and mutator given code such as: public string Name

Extension methods

Extension methods are a form of syntactic sugar providing the illusion of adding new methods to the existing class outside its definition. In practice, an extension method is a static method that is callable as if it was an instance method; the receiver of the call is bound to the first parameter of the method, decorated with keyword this:

public static class StringExtensions

string s = "foo"; s.Left(3); // same as StringExtensions.Left(s, 3);

Partial methods

Partial methods allow code generators to generate method declarations as extension points that are only included in the source code compilation if someone actually implements it in another portion of a partial class.

Features of C# 4.0

The next version of the language, C# 4.0, is under development as of October 2008. Microsoft has announced a list of new language features in C# 4.0 on Microsoft Professional Developers Conference
Professional Developers Conference

Microsoft's Professional Developers Conference is a conference for software developers, normally Microsoft Windows developers.It covers new and upcoming technology from Microsoft, and so only occurs in the years when there is something new to talk about....
 2008. The major focus of the next version is interoperability with partially or fully dynamically typed languages and frameworks, such as the Dynamic Language Runtime
Dynamic Language Runtime

The Dynamic Language Runtime from Microsoft is an ongoing effort to bring a set of services that run on top of the Common Language Runtime and provides language services for several different dynamic languages....
 and COM
Component Object Model

Component Object Model is an interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages....
. The following new features were announced:

Dynamic member lookup

A new pseudo-type dynamic is introduced into the C# type system. It is treated as System.Object, but in addition, any member access (method call, field, property, or indexer access, or a delegate invocation) or application of an operator on a value of such type is permitted without any type checking, and its resolution is postponed until run-time. For example:

// Returns the value of Length property or field of any object int GetLength(dynamic obj)

GetLength("Hello, world");// a string has a Length property, GetLength(new int[] ); // and so does an array, GetLength(42); // but not an integer - an exception will be thrown here at run-time

Dynamic method calls are triggered by a value of type "dynamic" as any implicit or explicit parameter (and not just a receiver). For example:

void Print(dynamic obj)

Print(123); // ends up calling WriteLine(int) Print("abc"); // ends up calling WriteLine(string)

Dynamic lookup is performed using three distinct mechanisms: COM IDispatch
IDispatch

IDispatch is the Interface that exposes the OLE Automation protocol. It is one of the standard interfaces that can be exposed by Component Object Model objects....
 for COM objects, IDynamicObject DLR interface for objects implementing that interface, and Reflection
Reflection (computer science)

In computer science, reflection is the process by which a computer program can observe and modify its own structure and behaviour. The programming paradigm driven by reflection is called reflective programming....
 for all other objects. Any C# class can therefore intercept dynamic calls on its instances by implementing IDynamicObject.

In case of dynamic method and indexer calls, overload resolution happens at run-time according to the actual types of the values passed as arguments, but otherwise according to the usual C# overloading resolution rules. Furthermore, in cases where the receiver in a dynamic call is not itself dynamic, run-time overload resolution will only consider the methods that are exposed on the declared compile-time type of the receiver. For example:

class Base

class Derived : Base

dynamic x = 123; Base b = new Derived; b.Foo(x); // picks Base.Foo(double) because b is of type Base, and Derived.Foo(int) is not exposed dynamic b1 = b; b1.Foo(x); // picks Derived.Foo(int)

Any value returned from a dynamic member access is itself of type dynamic. Values of type dynamic are implicitly convertible both from and to any other type. In the code sample above, this permits GetLength function to treat the value returned by a call to Length as an integer without any explicit cast. At run-time, the actual value will be converted to the requested type.

Covariant and contravariant generic type parameters


Generic
Generic programming

Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters and was pioneered by Ada which appeared in 1983....
 interfaces and delegates can have their type parameters marked as covariant
Covariance and contravariance (computer science)

Within the type system of a programming language, an operator from types to types is covariant if it preserves the subtype, which orders types from more specific ones to more generic ones; it is contravariant if it reverses this ordering....
 or contravariant
Covariance and contravariance (computer science)

Within the type system of a programming language, an operator from types to types is covariant if it preserves the subtype, which orders types from more specific ones to more generic ones; it is contravariant if it reverses this ordering....
, using keywords out and in, respectively. These declarations are then respected for type conversions, both implicit and explicit, and both compile-time and run-time. For example, the existing interface IEnumerable has been redefined as follows:

interface IEnumerable



Therefore, any class that implements IEnumerable for some class Derived is also considered to be compatible with IEnumerable for all classes and interfaces Base that Derived extends, directly, or indirectly. In practice, it makes it possible to write code such as:

void PrintAll(IEnumerable objects)

IEnumerable strings = new List; PrintAll(strings); // IEnumerable is implicitly converted to IEnumerable

For contravariance, the existing interface IComparer has been redefined as follows: public interface IComparer

Therefore, any class that implements IComparer for some class Base is also considered to be compatible with IComparer for all classes and interfaces Derived that are extended from Base. It makes it possible to write code such as: IComparer objectComparer = GetComparer; IComparer stringComparer = objectComparer;

Optional ref Keyword when using COM

The ref keyword for callers of methods is now optional when calling into methods supplied by COM interfaces. Given a COM method with the signature void Increment(ref int x); the invocation can now be written as either Increment(0); // no need for "ref" or a place holder variable any more or int x = 0; Increment(ref x);

Optional parameters and named arguments


C# 4.0 introduces optional parameters with default values as seen in C++. For example:

void Increment(ref int x, int dx = 1)

int x = 0; Increment(ref x); // dx takes the default value of 1 Increment(x, 2); // dx takes the value 2

In addition, to complement optional parameters, it is possible to explicitly specify parameter names in method calls, allowing to selectively pass any given subset of optional parameters for a method. The only restriction is that named parameters must be placed after the unnamed parameters. Parameter names can be specified for both optional and required parameters, and can be used to improve readability or arbitrarily reorder arguments in a call. For example:

Stream OpenFile(string name, FileMode mode = FileMode.Open, FileAccess access = FileAccess.Read)

OpenFile("file.txt"); // use default values for both "mode" and "access" OpenFile("file.txt", mode: FileMode.Create); // use default value for "access" OpenFile("file.txt", access: FileAccess.Read); // use default value for "mode" OpenFile(name: "file.txt", access: FileAccess.Read, mode: FileMode.Create); // name all parameters for extra readability, // and use order different from method declaration

Optional parameters make interoperating with COM easier. Previously, C# had to pass in every parameter in the method of the COM component, even those that are optional. For example:

object fileName = "Test.docx"; object missing = System.Reflection.Missing.Value;

doc.SaveAs(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);

With support for optional parameters, the code can be shortened as doc.SaveAs(ref fileName);

Indexed properties


Indexed properties (and default properties) of COM objects are now recognised, but C# objects still do not support them.

Preprocessor

C# features "preprocessor directives" (though it does not have an actual preprocessor) based on the C preprocessor
C preprocessor

The C preprocessor is the preprocessor for the C . In many C implementations, it is a separate computer program invoked by the compiler as the first part of translation....
 that allow programmers to define symbols but not macros. Conditionals such as #if, #endif, and #else are also provided. Directives such as #region give hints to editors for code folding
Code folding

Code folding is a feature of some text editors, source code editors and integrated development environments that allows the user to selectively hide and display sections of a currently-edited file as a part of routine edit operations....
.

Code comments

C# utilizes a double forward slash (//) to indicate the rest of the line is a comment.

public class Foo



Multi-line comments can be indicated by a starting forward slash/asterisk (/*) and ending asterisk/forward slash (*/).

public class Foo



XML documentation system

C#'s documentation system is similar to Java's Javadoc
Javadoc

Javadoc is a documentation generator from Sun Microsystems for generating Application programming interface documentation in HTML format from Java source code....
, but based on XML
Extensible Markup Language

The Extensible Markup Language is a general-purpose specification for creating custom markup languages. It is classified as an extensible language, because it allows the user to define the mark-up elements....
. Two methods of documentation are currently supported by the C# compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
.

Single-line comments, such as those commonly found in Visual Studio
Microsoft Visual Studio

Microsoft Visual Studio is an integrated development environment from Microsoft. It can be used to develop Console application and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all platforms supported by Microsoft W...
 generated code, are indicated on a line beginning with ///.

public class Foo



Multi-line comments, while defined in the version 1.0 language specification, were not supported until the .NET
.NET Framework

The Microsoft .NET Framework is a software framework that is available with several Microsoft Windows operating systems. It includes a large Library of coded solutions to prevent common programming problems and a virtual machine that manages the execution of programs written specifically for the Software framework....
 1.1 release. These comments are designated by a starting forward slash/asterisk/asterisk (/**) and ending asterisk/forward slash (*/).

public class Foo



Note there are some stringent criteria regarding white space and XML documentation when using the forward slash/asterisk/asterisk (/**) technique.

This code block: /** * * A summary of the method.*/

produces a different XML comment than this code block: /** * A summary of the method.*/

Syntax for documentation comments and their XML markup is defined in a non-normative annex of the ECMA
Ecma International

'Ecma International' is an international, private non-profit standards organization for information and communication systems. It acquired its name in 1994, when the European Computer Manufacturers Association changed its name to reflect the organization's international reach....
 C# standard. The same standard also defines rules for processing of such comments, and their transformation to a plain XML document with precise rules for mapping of CLI
Common Language Infrastructure

The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
 identifiers to their related documentation elements. This allows any C# IDE
Integrated development environment

An integrated development environment also known as integrated design environment or integrated debugging environment is a software application that provides comprehensive facilities to computer programmers for software development....
 or other development tool to find documentation for any symbol in the code in a certain well-defined way.

Libraries

The C# specification details a minimum set of types and class libraries that the compiler expects to have available. In practice, C# is most often used with some implementation of the Common Language Infrastructure
Common Language Infrastructure

The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
 (CLI), which is standardized as ECMA-335 Common Language Infrastructure (CLI).

"Hello, world" example

The following is a very simple C# program, a version of the classic "Hello world" example:

class ExampleClass



The effect is to write the following text to the output console:

Hello, world!

Each line has a purpose:

class ExampleClass

Above is a class
Class (computer science)

In object-oriented programming, a class is a programming language construct that is used as a blueprint to create Object s. This blueprint includes Attribute s and Method s that the created objects all share....
 definition. Everything between the following pair of braces describes ExampleClass.

static void Main

This declares the class member method where the program begins execution. The .NET runtime calls the Main method. (Note: Main may also be called from elsewhere, e.g. from the code Main in another method of ExampleClass.) The static keyword makes the method accessible without an instance of ExampleClass. Each console application's Main entry point must be declared static. Otherwise, the program would require an instance, but any instance would require a program. To avoid that irresolvable circular dependency
Circular dependency

A Circular dependency is a software engineering term describing a relation between two or more software modules which either directly or indirectly depend on each other to function properly....
, C# compilers processing console applications (like above) report an error if there is no static Main method. The void keyword declares that Main has no return value (see also side effect
Side effect (computer science)

In computer science, a subroutine or expression is said to produce a side effect if it modifies some state_ in addition to returning a value. For example, a function might modify a global or a static variable, modify one of its arguments, write data to a display or file, or read some data from other side-effecting functions....
).

Console.WriteLine("Hello, world!");

This line writes the output. Console is a static class in the System namespace. It provides an interface to the standard input, output, and error streams for console applications. The program calls the Console method WriteLine, which displays on the console a line with the argument, the string "Hello, world!".

Standardization

In August, 2000, Microsoft Corporation, Hewlett-Packard and Intel Corporation co-sponsored the submission of specifications for C# as well as the Common Language Infrastructure (CLI) to the standards organization ECMA International. In December 2001 , ECMA released ECMA-334 C# Language Specification. C# became an ISO standard in 2003 (ISO/IEC 23270:2006 - Information technology -- Programming languages -- C#). ECMA had previously adopted equivalent specifications as the 2nd edition of C#, in December, 2002.

In June 2005, ECMA approved edition 3 of the C# specification, and updated ECMA-334. Additions included partial classes, anonymous methods, nullable types, and generics
Generic programming

Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters and was pioneered by Ada which appeared in 1983....
 (similar to C++ templates
Template (programming)

Templates are a feature of the C++ programming language that allow functions and classes to operate with Generic programming. This allows a function or class to work on many different datatype without being rewritten for each one....
).

In July 2005, ECMA submitted the standards and related TRs to ISO/IEC JTC 1 via the latter's Fast-Track process. This process usually takes 6-9 months.

Criticism


Although the C# language definition and the CLI
Common Language Infrastructure

The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
 are standardized under ISO and ECMA
ECMA

Ecma or ECMA may refer to one of the following:Ecma is short for*Ecma International , formerly : the European Computer Manufacturers Association , an international standards organization for Information Communication Technology and Consumer Electronics ...
 standards, the CLI is only a part of Microsoft's Base Class Library
Base Class Library

The Base Class Library is a standard library available to all languages using the .NET Framework. .NET includes the BCL in order to encapsulate a large number of common functions, such as file reading and writing, graphic rendering, database interaction, and XML document manipulation, which makes the programmer's job easier....
 (BCL), which also contains non-standardized classes that are used by many C# programs (some extended IO
Input/output

In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world ? possibly a human, or another information processing system....
, User Interface
Windows Forms

Windows Forms is the name given to the graphical user interface application programming interface included as a part of Microsoft .NET Framework, providing access to the native Microsoft Windows interface elements by wrapping the existing Windows API in managed code....
, Web service
Web service

A Web service is defined by the W3C as "a software system designed to support interoperability Machine to Machine interaction over a computer network"....
s, etc). Furthermore, parts of the BCL have been patented by Microsoft, which may deter independent implementations of the full framework, as only the standardized portions have RAND
Reasonable and Non Discriminatory Licensing

Reasonable and Non Discriminatory Licensing is a term for a type of licensing typically used during standardization processes. The normal case is that when joining the standardization body, companies agree that if they receive any patents on technologies which become essential patent to the standard then they agree to allow other groups att...
 protection from patent claims.

Implementations



The most commonly used C# compiler is Microsoft Visual C#
Microsoft Visual C Sharp

Microsoft Visual C# is Microsoft's implementation of the C Sharp specification, included in the Microsoft Visual Studio suite of products. It is based on the Ecma International/International Organization for Standardization specification of the C# language, which Microsoft also created....
.

C# compilers are also provided with:

  • Microsoft's Rotor project (currently called Shared Source Common Language Infrastructure
    Shared Source Common Language Infrastructure

    The Shared Source Common Language Infrastructure , previously codenamed Rotor, is Microsoft's shared source implementation of the Common Language Infrastructure, the core of Microsoft .NET....
    ) (licensed for educational and research use only) provides a shared source
    Shared source

    Shared Source is Microsoft's framework for sharing computer program source code with third parties. Microsoft's Shared Source Initiative, launched in May 2007, includes a spectrum of technologies and licenses....
     implementation of the CLR runtime and a C# compiler, and a subset of the required Common Language Infrastructure
    Common Language Infrastructure

    The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
     framework libraries in the ECMA specification.


  • The Mono
    Mono (software)

    Mono is a project led by Novell to create an Ecma International standard compliant, .NET Framework-compatible set of tools, including among others a C Sharp compiler and a Common Language Runtime....
     project provides an open source
    Open source

    Open source is an approach to design, development, and distribution offering practical accessibility to a product's source . Some consider open source as one of various possible design approaches, while others consider it a critical Strategy element of their business operations....
     C# compiler, a complete open source
    Open source

    Open source is an approach to design, development, and distribution offering practical accessibility to a product's source . Some consider open source as one of various possible design approaches, while others consider it a critical Strategy element of their business operations....
     implementation of the Common Language Infrastructure
    Common Language Infrastructure

    The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
     including the required framework libraries as they appear in the ECMA specification, and a nearly complete implementation of the Microsoft proprietary .NET class libraries up to .NET 2.0, but not specific .NET 3.0 and .NET 3.5 libraries, as of Mono 2.0.


  • The DotGNU
    DotGNU

    DotGNU is a part of the GNU Project that aims to provide a free software replacement for Microsoft's .NET Framework. Other goals of the project are better support for non-Microsoft Windows platforms and support for more processors....
     project also provides an open source
    Open source

    Open source is an approach to design, development, and distribution offering practical accessibility to a product's source . Some consider open source as one of various possible design approaches, while others consider it a critical Strategy element of their business operations....
     C# compiler, a nearly complete implementation of the Common Language Infrastructure
    Common Language Infrastructure

    The Common Language Infrastructure is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the .NET Framework, Mono , and Portable.NET....
     including the required framework libraries as they appear in the ECMA specification, and subset of some of the remaining Microsoft proprietary .NET class libraries up to .NET 2.0 (those not documented or included in the ECMA specification but included in Microsoft's standard .NET Framework distribution).


  • DotNetAnywhere - Micro Framework-like Common Language Runtime
    Common Language Runtime

    The Common Language Runtime is a core component of Microsoft .NET Framework initiative. It is Microsoft's implementation of the Common Language Infrastructure standard, which defines an execution environment for program code....
    , aimed on embedded systems, supports almost all C# 2.0 specifications.


Language name

The name "C sharp" was inspired from musical notation
Musical notation

Music notation or musical notation is any system which represents aurally perceived music, through the use of written Modern musical symbols....
 where a sharp
Sharp (music)

In music, sharp means higher in pitch. More specifically, in musical notation, sharp means "higher in pitch by a semitone ," and has an associated symbol , which is often confused with the number sign ....
 indicates that the written note should be made a half-step higher in pitch. This is similar to the language name of C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
, where the two "+" symbols indicate that a variable should be incremented by 1. The Sharp symbol also resembles a ligature of four "+" symbols (arranged in a two-by-two grid), furthermore implying that the language is an increment of C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
.

Due to technical limitations of display (fonts, browsers, etc.) and the fact that the sharp symbol (
Sharp (music)

In music, sharp means higher in pitch. More specifically, in musical notation, sharp means "higher in pitch by a semitone ," and has an associated symbol , which is often confused with the number sign ....
, U+266F, MUSIC SHARP SIGN) is not present on the standard keyboard, the number sign
Number sign

'Number sign' is a name for the symbol '#'; it is the preferred Unicode name for the code point associated with that glyph. The symbol is similar to the musical symbol called Sharp ....
 (#, U+0023, NUMBER SIGN) was chosen to represent the sharp symbol in the written name of the programming language. This convention is reflected in the ECMA-334 C# Language Specification. However, when it is practical to do so (for example, in advertising or in box art), Microsoft will use the intended musical sharp symbol.

The "sharp" suffix has been used by a number of other .NET languages that are variants of existing languages, including J#
J Sharp

The J# programming language is a transitional language for programmers of Sun Microsystems's Java and Microsoft's J++ languages, so they may use their existing knowledge and applications on Microsoft's Microsoft .NET platform ....
 (a .NET language also designed by Microsoft which is derived from Java 1.1), A#
A Sharp (.NET)

A# is a port of the Ada programming language to the .NET Framework platform. A# is freely distributed by the Department of Computer Science at the United States Air Force Academy as a service to the Ada programming language community under the terms of the GNU General Public License....
 (from Ada), and the functional F#. The original implementation of Eiffel for .NET
EiffelStudio

EiffelStudio is a development environment for the Eiffel developed and distributed by Eiffel Software.EiffelStudio includes a combination of tools integrated under a single user interface: compiler, interpreter, debugger, browser, metrics tool, profiler, diagram tool....
 was called Eiffel#, a name since retired since the full Eiffel
Eiffel (programming language)

Eiffel is an International Organization for Standardization-standardized, object-oriented programming language designed to enable programmers to efficiently develop extensible, reusable, reliable software....
 language is now supported. The suffix is also sometimes used for libraries, such as Gtk#
Gtk Sharp

Gtk# is a set of .NET Framework binding s for the GTK+ Graphical user interface Widget toolkit and assorted GNOME Library . The library facilitates building graphical GNOME applications using Mono or any other compliant Common Language Runtime....
 (a .NET wrapper for GTK+
GTK+

GTK+, or The GIMP Toolkit, is a cross-platform widget toolkit for creating graphical user interfaces. It is one of the most popular toolkits for the X Window System, along with Qt ....
 and other GNOME
Gnome

A gnome is a mythical creature characterized by its extremely small size and wiktionary:subterranean lifestyle. The word gnome is derived from the New Latin gnomus....
 libraries), Cocoa#
Cocoa Sharp

Cocoa# is a bridge framework on Mac OS X to allow applications developed with the Mono to access the Cocoa API. It provides direct access to the Cocoa API using a dot notation familiar to languages working on the Mono runtime such as C#....
 (a wrapper for Cocoa
Cocoa (API)

Cocoa is one of Apple Inc.'s native object-oriented application program environment for the Mac OS X operating system. It is one of four major Application programming interfaces available for Mac OS X; the others are Carbon , POSIX , and Java platform....
) and Qt# (a .NET language binding for the Qt toolkit
Qt (toolkit)

Qt is a cross-platform application development framework, widely used for the development of graphical user interface programs , and also used for developing non-GUI programs such as console tools and servers....
).

See also

  • C# Syntax
    C Sharp syntax

    The syntax of the C Sharp is a set of rules which defines how to write and interpret code. This article contains new features of the upcoming C# 3.0....


Environments and tools

  • Microsoft Visual Studio
    Microsoft Visual Studio

    Microsoft Visual Studio is an integrated development environment from Microsoft. It can be used to develop Console application and graphical user interface applications along with Windows Forms applications, web sites, web applications, and web services in both native code together with managed code for all platforms supported by Microsoft W...
    , IDE for C#
  • SharpDevelop
    SharpDevelop

    SharpDevelop is a free and open source Integrated development environment for the C Sharp programming language, Visual Basic .NET , Boo , and F Sharp and IronPython programming languages....
    , an open-source C# IDE for Windows
    Microsoft Windows

    Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
  • MonoDevelop
    MonoDevelop

    MonoDevelop is an open source integrated development environment for the Linux platform, primarily targeted for the development of software that uses both the Mono and Microsoft .NET framework....
    , an open-source C# IDE for Linux
    Linux

    Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
  • QuickSharp 2008, a simplified development environment for C#
  • Morfik
    Morfik

    Morfik Technology Pty Ltd., an Australian company, is the developer of WebOS AppsBuilder, an Integrated development environment aimed at developing Ajax applications in a high-level language such as Java , C Sharp , BASIC or Object Pascal....
     C#, a C# to JavaScript compiler complete with IDE and framework for Web application development.
  • Baltie
    Baltie

    Baltie is a proprietary software Educational programming language computer programming language used as a learning aid for beginning programmers....
    , an educational IDE for children and students with little or no programming experience
  • Borland
    Borland

    Borland Software Corporation is a Computer software company headquartered in Austin, Texas. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn....
     Turbo C Sharp
    Turbo C Sharp

    Turbo C# was an Integrated Development Environment from Borland that came in two versions. The first is the free Explorer edition, which has a fixed IDE targeted towards student, amateur, and hobbyist programmers....


Related languages

  • C?
    C?

    C? is a free extension to the C Sharp programming language, developed by the WebData team in Microsoft SQL Server in collaboration with Microsoft Research in the United Kingdom and Redmond....
  • Spec#
    Spec sharp

    Spec# is a programming language with specification language features that extends the capabilities of the C Sharp programming language with Eiffel -like Design by Contract, including object invariants, preconditions and post-conditions....
  • Sing#
    Sing sharp

    Sing# is a concurrent programming language that is a superset of the Spec sharp programming language; in turn, Spec# is an extension of the C Sharp programming language....
  • Parallel C#
    Parallel C

    Parallel C may refer to:* Unified Parallel C, an extension of the C programming language designed for high-performance computing on large-scale parallel machines...


Comparisons

  • Alphabetical list of programming languages
    Alphabetical list of programming languages

    The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in alphabetical order....
  • Comparison of programming languages
    Comparison of programming languages

    Programming languages are used for controlling the behavior of a machine . Like natural languages, programming languages conform to rules for syntax and semantics....


External links

  • - hyperlinked
  • ISO C# Language Specification - or .
  • - Unique and fun interactive learning website with blog.