FACTOID # 10: The total number of state executions in 2005 was 60: 19 in Texas and 41 elsewhere. The racial split was 19 Black and 41 White.
 
 Home   Encyclopedia   Statistics   States A-Z   Flags   Maps   FAQ   About 
 
WHAT'S NEW
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > C sharp
C#
Paradigm structured, imperative, object-oriented
Appeared in 2001 (last revised 2005)
Designed by Microsoft Corporation
Typing discipline static, strong, both safe and unsafe, nominative
Major implementations .NET Framework, Mono, DotGNU
Dialects 1.0, 1.5 , 2.0 (ECMA)
Influenced by Delphi, C++, Java, Modula-3, Eiffel
Influenced Nemerle, D, Java[1]

C# (see section on name, pronunciation) is an object-oriented programming language developed by Microsoft as part of the .NET initiative and later approved as a standard by ECMA and ISO. Anders Hejlsberg leads development of the C# language, which has a procedural, object-oriented syntax based on C++ and includes aspects of several other programming languages (most notably Delphi and Java) with a particular emphasis on simplification. Do Dièse or C♯ (C sharp) is the second semitone of the solfege. ... A programming paradigm is a paradigmatic style of programming (compare with a methodology, which is a paradigmatic style of doing software engineering). ... Structured programming can be seen as a subset or subdiscipline of procedural programming, one of the major programming paradigms. ... In computer science, imperative programming, as opposed to declarative programming, is a programming paradigm that describes computation in terms of a program state and statements that change the program state. ... Object-oriented programming (OOP) is a programming paradigm that uses objects and their interactions to design applications and computer programs. ... Year 2001 (MMI) was a common year starting on Monday (link displays the 2001 Gregorian calendar). ... Year 2005 (MMV) was a common year starting on Saturday (link displays full calendar) of the Gregorian calendar. ... Microsoft Corporation (NASDAQ: MSFT), (founded 1975), headquartered in Redmond, Washington, USA, is the worlds largest software company (with over 50,000 employees in various countries, as of May 2004). ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... A nominative type system is a major classes of type system, in which type compatibility and equivalence is determined by explicit declarations and/or the name of the types. ... Look up Implementation in Wiktionary, the free dictionary. ... The Microsoft . ... Mono is a project led by Novell (formerly by Ximian) to create an Ecma standard compliant . ... DotGNU is a part of the GNU Project that aims to provide a free software replacement for the Microsoft . ... A dialect of a programming language is a (relatively small) variation or extension of the language that does not change its intrinsic nature. ... Delphi is the primary programming language of Borland Delphi. ... C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ... “Java language” redirects here. ... This article or section does not adequately cite its references or sources. ... Eiffel is an ISO-standardized object-oriented programming language designed for extensibility, reusability, reliability and programmer productivity. ... Nemerle is a high-level statically-typed programming language for the . ... D is an object-oriented, imperative system programming language designed by Walter Bright of Digital Mars as a re-engineering of C/C++. He has done this by re-designing many C++ features, and borrowing ideas from other programming languages. ... “Java language” redirects here. ... The title given to this article is incorrect due to technical limitations. ... Object-oriented programming (OOP) is a programming paradigm that uses objects and their interactions to design applications and computer programs. ... A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. ... Microsoft Corporation, (NASDAQ: MSFT, HKSE: 4338) is a multinational computer technology corporation with global annual revenue of US$44. ... Microsoft . ... Ecma International is an international, private (membership-based) standards organization for information and communication systems. ... “ISO” redirects here. ... Anders Hejlsberg (born December 1960[1]) is a prominent Danish software engineer who co-designed several popular and commercially successful programming languages and development tools. ... For other uses, see Syntax (disambiguation). ... C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ... Delphi is the primary programming language of Borland Delphi. ... “Java language” redirects here. ...


This article describes the C# language as defined in the ECMA and ISO standards. For a description of Microsoft's implementation, see Microsoft Visual C#. Microsoft Visual C# is Microsofts ultimate IDE for the C# programming language exact specification. ...

Contents

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, detection of attempts to use uninitialized variables, source code portability, and automatic garbage collection.
  • 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 systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions.
  • Although C# applications are intended to be economical with regards to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language.

A USB drive, shown with a 24 mm US quarter coin for scale. ... In computer science, garbage collection (GC) is a form of automatic memory management. ... Software component representations: above the representation used in UML, below the representation commonly used by Microsofts COM objects. ... Internationalization and localization are means of adapting products such as publications or software for non-native environments, especially other nations and cultures. ... A router, an example of an embedded system. ... An operating system (OS) is the software that manages the sharing of the resources of a computer and provides programmers with an interface used to access those resources. ... The clock rate is the fundamental rate in cycles per second (measured in hertz) at which a computer performs its most basic operations such as adding two numbers or transferring a value from one processor register to another. ... See the terminology section, below, regarding inconsistent use of the terms assembly and assembler. ...

Architectural history

C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg. His previous experience in programming language and framework design (Visual J++, Borland Delphi, Turbo Pascal) can be readily seen in the syntax of the C# language, as well as throughout the Common Language Runtime (CLR) core. In interviews and technical papers he has stated that flaws in most major programming languages (e.g. C++, Java, Delphi, and Smalltalk) drove the fundamentals of the CLR, which, in turn, drove the design of the C# programming language itself. Some argue that C# shares roots in other languages.[2] Anders Hejlsberg (born December 1960[1]) is a prominent Danish software engineer who co-designed several popular and commercially successful programming languages and development tools. ... Visual J++ (pronounced Jay Plus Plus) is Microsofts now discontinued implementation of the Java programming language. ... Delphi has been released in many versions, including older versions which have been released in magazines for non-profit application use For the language Borland Delphi is programmed in, see Object Pascal. ... Turbo Pascal 3. ... For other uses, see Syntax (disambiguation). ... The Common Language Runtime (CLR) is the virtual machine component of Microsofts . ... C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ... “Java language” redirects here. ... Delphi is the primary programming language of Borland Delphi. ... For other uses, see Small talk. ...


Features

The following description is based on the language standard and other documents listed in the External Reference section.


By design, C# is the programming language that most directly reflects the underlying Common Language Infrastructure (CLI). Most of C#'s intrinsic types correspond to value-types implemented by the CLI framework. However, the C# 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 (CLR), or generate Common Intermediate Language (CIL), or generate any other specific format. Theoretically, a C# compiler could generate machine code like traditional compilers of C++ or FORTRAN; in practice, all existing C# implementations target CLI. Visual overview of the Common Language Infrastructure (CLI) The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft . ... The Common Language Runtime (CLR) is the virtual machine component of Microsofts . ... Common Intermediate Language (CIL, pronounced either sill or kill) (formerly called Microsoft Intermediate Language or MSIL) is the lowest-level human-readable programming language in the Common Language Infrastructure and in the . ...


C# differs from C and C++ in many ways, including:

  • There are no global variables or functions. All methods and members must be declared within classes.
  • Local variables cannot shadow variables of the enclosing block, unlike C and C++. Variable shadowing is often considered confusing by C++ texts.
  • C# supports a strict boolean type, 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 prevents certain types of programming mistakes.
  • In C#, 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 references, which cannot be made invalid. 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 leaks. C# also provides direct support for deterministic finalization with the using statement (supporting the Resource Acquisition Is Initialization idiom).
  • Multiple inheritance 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 and simplify architectural requirements throughout CLI.
  • C# is more typesafe than C++. The only implicit conversions by default are safe conversions, such as widening of integers and conversion from a derived type to a base type. This is enforced at compile-time, during JIT, and, in some cases, at runtime. There are no implicit conversions between booleans and integers and between enumeration members and integers (except 0, which can be implicitly converted to an enumerated type), and any user-defined conversion must be explicitly marked as explicit or implicit, unlike C++ copy constructors (which are implicit by default) and conversion operators (which are always implicit).
  • Enumeration members are placed in their own namespace.
  • Accessors called properties can be used to modify an object with syntax that resembles C++ member field access. In C++, declaring a member public enables both reading and writing to that member, and accessor methods must be used if more fine-grained control is needed. In C#, properties allow control over member access and data validation.
  • Full type reflection and discovery is available.

In computer science, garbage collection (GC) is a form of automatic memory management. ... In computer science, a memory leak is a particular kind of unintentional memory consumption by a computer program where the program fails to release memory when no longer needed. ... Resource Acquisition Is Initialization, often referred to by the acronym RAII, is a popular design pattern in C++ and D. The technique combines acquisition and release of resources with initialization and uninitialization of objects. ... Multiple inheritance refers to a feature of object-oriented programming languages in which a class can inherit behaviors and features from more than one superclass. ... Dependency hell is a colloquial term for the frustration of some software users who have installed software packages which have dependencies on specific versions of other software packages. ... In computer science, a programming language is type safe when the language does not permit the programmer to treat a value as a type to which it does not belong. ... For other uses, see Just In Time. ... A copy constructor is a special constructor in the C++ programming language used to create a new object as a copy of an existing object. ... In computer programming, an enumerated type is an abstract data type used to model an attribute that has a specific number of options (or identifiers) such as the suit of a playing card (i. ... A namespace is a context in which a group of one or more identifiers might exist. ... In computer science, reflection is the process by which a computer program of the appropriate type can be modified in the process of being executed, in a manner that depends on abstract features of its code and its runtime behavior. ...

Unified type system

C# has a unified type system. This means 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. Boxing and unboxing allow one to translate primitive data to and from their object form. Effectively, this makes the primitive types a subtype of the Object type. Primitive types can also define methods (e.g., 42.ToString() calls the ToString() method on an integer), and in the programmer's perspective behave like any other object. In computer science, primitive types, as distinct from composite types - are datatypes provided by a programming language as basic building blocks. ... To meet Wikipedias quality standards, this article or section may require cleanup. ... In computer science, an object type (a. ... In computer science, an object type (a. ...


C# allows the programmer to create user-defined value types, using the struct keyword. From the programmer's perspective, they can be seen as lightweight classes. Unlike regular classes, and like the standard primitives, such value types are allocated on the stack rather than on the heap. They can also be part of an object (either as a field or boxed), or stored in an array, without the memory indirection that normally exists for class types. Structs also come with a number of limitations. Because structs have no notion of a null value and can be used in arrays without initialization, they are implicitly initialized to default values (normally by filling the struct memory space with zeroes, but the programmer can specify explicit default values to override this). The programmer can define additional constructors with one or more arguments. This also means that structs lack a virtual method table, and because of that (and the fixed memory footprint), they cannot allow inheritance (but can implement interfaces). In computer science, primitive types — as distinct from composite types — are data types provided by a programming language as basic building blocks. ... In computer science, a call stack is a special stack which stores information about the active subroutines of a computer program. ... A virtual method table, virtual function table, dispatch table, or vtable, is a mechanism used in programming language implementations in order to support dynamic polymorphism, i. ...


C# 2.0 new language features

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

  • Partial classes allow class implementation across more than one file. This permits breaking down very large classes, or is useful if some parts of a class are automatically generated.

file1.cs: Partial Classes, or Partial Types, in object oriented computer programming languages, means the ability to split a class definition across several files, or several places within a single file. ...

 public partial class MyClass { public MyClass() { // implementation } } 

file2.cs:

 public partial class MyClass { public void SomeMethod() { // implementation } } 
  • Generics or parameterized types. This 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 to make parameterized types first-class objects in the CLI Virtual Machine, which allows for optimizations and preservation of the type information.
  • Static classes that cannot be instantiated, and that only allow static members. This is similar to the concept of module in many procedural languages.
  • A new form of iterator that provides generator functionality, using a yield return construct similar to yield in Python.
 // Method that takes an iterable input (possibly an array) and returns all even numbers. public static IEnumerable<int> GetEven(IEnumerable<int> numbers) { foreach (int i in numbers) { if (i % 2 == 0) yield return i; } } 
  • Anonymous delegates providing closure functionality.
 public void Foo(object parameter) { // ... ThreadPool.QueueUserWorkItem(delegate { // anonymous delegates have full access to local variables of the enclosing method if (parameter == ...) { // ...  } // ... }); } 
 string status = string.Empty; public string Status { get { return status; } // anyone can get value of this property, protected set { status = value; } // but only derived classes can change it } 
  • Nullable value types (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 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<T> 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: Generic programming is a style of computer programming where algorithms are written in an extended grammar and are made adaptable by specifying variable parts that are then somehow instantiated later by the compiler with respect to the base grammar. ... Reification, in the context of object-oriented programming, is the implementation of an abstract behavior. ... Visual overview of the Common Language Infrastructure (CLI) The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft . ... It has been suggested that this article or section be merged into Modularity (programming). ... In computer science, an iterator is an object which allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation. ... In computer science, a generator is a special routine that can be used to control the iteration behaviour of a loop. ... The syntax of the Python programming language is the set of rules that defines how a Python program will be written and interpreted (by both the runtime system and by human readers). ... In computer science, a closure is a function that is evaluated in an environment containing one or more bound variables. ... A covariant type operator in a type system preserves the ordering ≤ of types. ... A delegate is a form of type-safe function pointer used in the . ... In most programming languages object references or pointers can be set to NULL, meaning that that the pointer points to nowhere or that no object is assigned. ... The Eleventh Hour is a figure of speech referring to the last moments before a deadline, or meant to imply that a decisive or final moment is near. ... In computer science, an object type (a. ...

 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[citation needed], since it required core-CLR changes affecting not only .NET2, but all dependent technologies (including C#, VB, SQL Server 2005 and Visual Studio 2005). The Common Language Runtime (CLR) is the virtual machine component of Microsofts . ...

  • Coalesce operator: (??) returns the first of its operands which is not null:
 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; // Unless i is null, initialize j to i. Else (if i is null), initialize j to 0. 

C# 3.0 new language features

C# 3.0 is the next version of the language as proposed by Microsoft. It includes new features inspired by functional programming languages such as Haskell and ML, and is driven largely by the introduction of the Language Integrated Query (LINQ) pattern to the Common Language Runtime.[3] Image File history File links Gnome_globe_current_event. ... Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. ... Haskell is a standardized purely functional programming language with non-strict semantics, named after the logician Haskell Curry. ... ML is a general-purpose functional programming language developed by Robin Milner and others in the late 1970s at the University of Edinburgh, whose syntax is inspired by ISWIM. Historically, ML stands for metalanguage as it was conceived to develop proof tactics in the LCF theorem prover (the language of... Language intergrated query (LINQ) is a Microsoft project that aims to add a native querying syntax to C# and VB.Net. ...

  • Language Integrated Query:[4] "from, where, select" context-sensitive keywords allowing queries across SQL, XML, collections, and more. These are treated as keywords in the LINQ context, but their addition won't break existing variables named from, where, or select.
  • Object initializers: Customer c = new Customer(); c.Name = "James"; can be written Customer c = new Customer { Name="James" };
  • Collection initializers: MyList list = new MyList(); list.Add(1); list.Add(2); can be written as MyList list = new MyList { 1, 2 }; (assuming that MyList implements System.Collections.IEnumerable and has a public Add method[5])
  • Anonymous types: var x = new { Name = "James" }
  • Local variable type inference: var x = "hello"; is interchangeable with string x = "hello";. More than just syntactic sugar, this feature is required for the declaration of anonymous typed variables.
  • Implicitly-typed arrays: The type of an array can now be omitted, so that int[] arr = new int[] { 1, 2, 3 } can now be written as var arr = new[] { 1, 2, 3 }.
  • Lambda expressions: listOfFoo.Where(delegate(Foo x) { return x.size > 10; }) can be written listOfFoo.Where(x => x.size > 10);
  • Compiler-inferred translation of Lambda expressions to either strongly-typed function delegates or strongly-typed expression trees
  • Automatic properties: The compiler will automatically generate a private instance variable and the appropriate getter and setter given code such as: public string Name { get; private set; }
  • Extension methods (adding methods to classes by including the this keyword in the first parameter of a method on another static class):
 public static class IntExtensions { public static void PrintPlusOne(this int x) { Console.WriteLine(x + 1); } } int foo = 0; foo.PrintPlusOne(); 
  • Partial methods: Allow codegenerators 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.[6]

C# 3.0 was unveiled at the 2005 Professional Developers Conference. A preview with specifications is available from the Visual C# site at Microsoft. It is not currently standardized by any standards organisation, though it is expected that it will eventually become an ECMA and then ISO standard, as did its predecessors. Language intergrated query (LINQ) is a Microsoft project that aims to add a native querying syntax to C# and VB.Net. ... Anonymous types are a feature of the C# 3. ... Type inference is a feature present in some strongly statically typed programming languages. ... Syntactic sugar is a term coined by Peter J. Landin for additions to the syntax of a computer language that do not affect its functionality but make it sweeter for humans to use. ... In computer science, the lambda calculus is a formal system designed to investigate function definition, function application, and recursion. ... In computer science, the lambda calculus is a formal system designed to investigate function definition, function application, and recursion. ... A parse tree or concrete syntax tree is a tree that represents the syntactic structure of a string according to some formal grammar. ... // One of the features of C# 3. ... Microsofts Professional Developers Conference (or PDC) is a conference for software developers, normally Windows developers. ... Standards Organizations are bodies, organizations and institutions that produce, and in some cases measure, standards. ...


Microsoft has emphasized that the new language features of C# 3.0 will be available without any changes to the runtime. This means that C# 2.0 and 3.0 will be binary-compatible (CLI implementations compatible with 2.0 are able to run 3.0 applications directly).


Although the new features may only slightly change simple in-memory queries, such as List.FindAll or List.RemoveAll, the pattern used by LINQ allows for significant extension points to enable queries over different forms of data, both local and remote.


Preprocessor

C# features "preprocessor directives"[7] (though it does not have an actual preprocessor) based on the C preprocessor that allows 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. The C preprocessor (cpp) is the preprocessor for the C programming language. ... Code folding is a feature of some text editors, program source code editors and IDEs that allows the user to selectively hide and display sections of a currently-edited file as a part of routine edit operations. ...


XML documentation system

C#'s documentation system is similar to Java's Javadoc, but based on XML. Multiline comments beginning with /** and single line comments beginning with /// are treated as documentation. Javadoc is a computer software tool from Sun Microsystems for generating API documentation into HTML format from Java source code. ... The Extensible Markup Language (XML) is a W3C-recommended general-purpose markup language that supports a wide variety of applications. ...

 public class Foo { /// <summary>A summary of the method.</summary> /// <param name="firstParam">A description of the parameter.</param> /// <remarks>Remarks about the method.</remarks> public static void Bar(int firstParam) {} } 

Syntax for documentation comments and their XML markup is defined in a non-normative annex of the ECMA 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 identifiers to their related documentation elements. This allows any C# IDE or other development tool to find documentation for any symbol in the code in a certain well-defined way.


Code libraries

The C# specification details a minimum set of types and class libraries that the compiler expects to have available and they define the basics required. In practice, C# is most often used with some implementation of the Common Language Infrastructure (CLI), which is standardized as ECMA-335 Common Language Infrastructure (CLI). Visual overview of the Common Language Infrastructure (CLI) The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft . ...


Hello world example

The following is a very simple C# program, a version of the classic "Hello world" example: A hello world program is a computer program that prints out Hello, world! on a display device. ...

 class ExampleClass { static void Main() { System.Console.WriteLine("Hello, world!"); } } 

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 definition. Everything between the following pair of braces describes ExampleClass. In object-oriented programming, a class is a programming language construct used to group related fields and methods. ...

 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, C# compilers run on 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 (computer science).) Circular dependencies is a situation which occurs in object oriented programming when two or more objects point towards each other in a circular fashion. ... In computer programming, a return statement causes execution to leave the current subroutine and resume at the point the subroutine was called -- this is called the return address. ... In computer science, a function is said to produce a side effect if it modifies some state other than its return value. ...

 System.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 international standardization organization ECMA. In December 2001 , ECMA released ECMA-334 C# Language Specification. C# became an ISO standard in 2003 (ISO/IEC 23270). ECMA had previously adopted equivalent specifications as the 2nd edition of C#, in December, 2002. Ecma International - European association for standardising information and communication systems came into existence in 1994, when the European Computer Manufacturers Association (ECMA) changed its name in order to reflect the international activities of the organisation (the long form of ECMA was dropped then, and capitalization changed to reflect this). ... ISO has many meanings: Iso is the stem of the Latin transliteration of the Greek word ίσος (ísos, meaning equal). The iso- prefix in English derives from this and means equality or similarity. ...


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 (similar to C++ templates). Generic programming is a style of computer programming where algorithms are written in an extended grammar and are made adaptable by specifying variable parts that are then somehow instantiated later by the compiler with respect to the base grammar. ... In computer programming, templates are a feature of the C++ programming language that allow code to be written without consideration of the data type with which it will eventually be used. ...


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

Performance

  • As with other Virtual Machine-based languages, C# programs are slower than for languages that compile directly into native code[8]. However, modern virtual machine technology often makes these penalties negligible for typical applications.[citation needed] Since C#’s Just in Time (JIT) Compiler, which does compile the program down to machine code, is expected to run fast it cannot use any optimizing techniques that are processor intensive[9] This sometimes makes a C# program slower then an equivalent C++ program. Also C# does a lot of parameter checking and Bounds Checking. Since most C/C++ libraries do not check parameters and expect valid inputs; the extra instructions that are ran in C# for these checks causes performance degradation.[10] Generally C#’s programs are slow to startup because of the JIT compiling, but once the JIT Compiler has run C# programs generally run on par or a small percentage slower than any machine compiled program.[11]

In computer science, a virtual machine is software that creates a virtualized environment between the computer platform and its operating system, so that the end user can operate software on an abstract machine. ... For other uses, see Just In Time. ... A diagram of the operation of a typical multi-language, multi-target compiler. ... Machine code or machine language is a system of instructions and data directly understandable by a computers central processing unit. ... In mathematics, optimization is the discipline which is concerned with finding the maxima and minima of functions, possibly subject to constraints. ... C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ... In computer programming, bounds checking is the name given to any method of detecting whether or not an index given lies within the limits of an array. ... C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ... C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ... In computer science, an instruction typically refers to a single operation of a processor within a computer architecture. ...

Language

  • Although primitive types are treated as Objects at the source level, which allows programmers to use them easily in contexts where only Objects are allowed (e.g., collections)[12], this is done under the hood in the language by boxing/unboxing them at the bytecode level. The creation of additional objects has a negative effect on performance. This also leads to a lot of pitfalls where the program's behavior is not the same as expected[13]. However, changes have been made since the introduction of generics in version 2.0[citation needed].

In computer science, an object type (a. ... Common Intermediate Language (CIL, pronounced either sill or kill) (formerly called Microsoft Intermediate Language or MSIL) is the lowest-level human-readable programming language in the Common Language Infrastructure and in the . ... Generic programming is a style of computer programming where algorithms are written in an extended grammar and are made adaptable by specifying variable parts that are then somehow instantiated later by the compiler with respect to the base grammar. ...

Platform

  • The reference .NET Microsoft implementation is only available on Windows. However, there are other implementations for running C# programs on Windows, Linux or MacOS X: Mono and DotGNU, although they are not complete yet[14].

Mono is a project led by Novell (formerly by Ximian) to create an Ecma standard compliant . ... DotGNU is a part of the GNU Project that aims to provide a free software replacement for the Microsoft . ...

Licensing

  • Although the C# language definition is standardized under an ISO standard, only a part of the Base Class Library, which contains the fundamental functions that are used by all C# programs (IO, User Interface, Web services, ...) is also standardized. Furthermore, parts of the BCL has been patented by Microsoft[15][16], which may deter non-Microsoft implementations of the full framework.

ISO has many meanings: Iso is the stem of the Latin transliteration of the Greek word ίσος (ísos, meaning equal). The iso- prefix in English derives from this and means equality or similarity. ... The Base Class Library (BCL) is a library of types and functionalities available to all languages using the . ... Energy Input: The energy placed into a reaction. ... This API is a part of . ... Web services architecture The W3C defines a Web service (many sources also capitalize the second word, as in Web Services) as a software system designed to support interoperable Machine to Machine interaction over a network. ...

Implementations

The de facto standard implementation of the C# language is Microsoft's C# compiler, included in every installation of .NET Framework, a version of which is used inside Microsoft's own Visual C# and Visual C# Express Edition IDEs, and directly invoked from Borland's C# Builder, and the open source SharpDevelop IDEs. The Microsoft . ... To meet Wikipedias quality standards, this article may require cleanup. ... To meet Wikipedias quality standards, this article may require cleanup. ... Open source refers to projects that are open to the public and which draw on other projects that are freely available to the general public. ... SharpDevelop is a free and open source IDE for the C#, Visual Basic . ...


Alternative C# compilers are:

  • The Mono project provides an open source C# compiler (written in C# itself), a complete open source implementation of the Common Language Infrastructure including the required framework libraries as they appear in the ECMA specification, and a nearly complete[citation needed] implementation of the remaining Microsoft proprietary .NET class libraries (libraries not documented or included in the ECMA specification but are included in Microsoft's standard .NET Framework distribution).
  • The DotGNU project also provides an open source C# compiler (written in C), a nearly complete implementation of the Common Language Infrastructure including the required framework libraries as they appear in the ECMA specification, and subset of some of the remaining Microsoft proprietary .NET class libraries (libraries not documented or included in the ECMA specification but are included in Microsoft's standard .NET Framework distribution).

The Shared Source Common Language Infrastructure (SSCLI), previously codenamed Rotor, is Microsofts shared source implementation of the CLI, the core of . ... Shared source is Microsoft’s framework for sharing computer program source code with individuals and organizations. ... Visual overview of the Common Language Infrastructure (CLI) The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft . ... Mono is a project led by Novell (formerly by Ximian) to create an Ecma standard compliant . ... Open source refers to projects that are open to the public and which draw on other projects that are freely available to the general public. ... Open source refers to projects that are open to the public and which draw on other projects that are freely available to the general public. ... Visual overview of the Common Language Infrastructure (CLI) The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft . ... DotGNU is a part of the GNU Project that aims to provide a free software replacement for the Microsoft . ... Open source refers to projects that are open to the public and which draw on other projects that are freely available to the general public. ... Visual overview of the Common Language Infrastructure (CLI) The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft . ...

Language name

According to the ECMA-334 C# Language Specification, section 6, Acronyms and abbreviations[17] the name of the language is written "C#" ("LATIN CAPITAL LETTER C (U+0043) followed by the NUMBER SIGN # (U+0023)") and pronounced "C Sharp".

C sharp language name
C sharp language name
C sharp musical note
C sharp musical note

Due to technical limitations of display (fonts, browsers, etc.) and the fact that the sharp symbol (, U+266F, MUSIC SHARP SIGN, see graphic at right if the symbol is not visible) is not present on the standard keyboard, the number sign (#) was chosen to represent the sharp symbol in the written name of the language. So, although the symbol in "C#" represents the sharp symbol, it is actually the number sign ("#"). Microsoft's C# FAQ refers to the sharp symbol in the language name.[18] James Kovacs, a Microsoft MVP, explains some of the history of C#.[19] Image File history File links This is a lossless scalable vector image. ... Image File history File links This is a lossless scalable vector image. ... Image File history File links This is a lossless scalable vector image. ... Image File history File links This is a lossless scalable vector image. ... Figure 1. ... The Microsoft Most Valuable Professional (MVP) Program is an award and recognition program run by Microsoft. ...


The choice to represent the sharp symbol () with the number sign (#) has led to confusion regarding the name of the language. For example, although most printed literature uses the correct number sign,[20] some (including from Microsoft's own material) incorrectly use the sharp symbol.[21]


The "sharp" suffix has been used by a number of other .NET languages that are variants of existing languages, including J# (Microsoft's implementation of Java), A# (from Ada), and F# (presumably from System F, the type system used by the ML family)[22]. The original implementation of Eiffel for .NET was called Eiffel#, a name since retired since the full Eiffel language is now supported. The suffix is also sometimes used for libraries, such as Gtk# (a .NET wrapper for GTK+ and other GNOME libraries) and Cocoa# (a wrapper for Cocoa).
The J# (pronounced J-sharp) programming language is a transitional language for programmers of Suns Java and Microsofts J++ languages, so they may use their existing knowledge, and applications on Microsofts . ... A# is a port of the Ada programming language to the Microsoft . ... Ada is a structured, statically typed imperative computer programming language designed by a team led by Jean Ichbiah of CII Honeywell Bull during 1977–1983. ... The title given to this article is incorrect due to technical limitations. ... System F is a typed lambda calculus. ... ML is a general-purpose functional programming language developed by Robin Milner and others in the late 1970s at the University of Edinburgh, whose syntax is inspired by ISWIM. Historically, ML stands for metalanguage as it was conceived to develop proof tactics in the LCF theorem prover (the language of... Eiffel is an ISO-standardized object-oriented programming language designed for extensibility, reusability, reliability and programmer productivity. ... Gtk#, a GUI Toolkit, is a set of . ... In computer programming, the adapter design pattern (sometimes referred to as the wrapper pattern) adapts one interface for a class into one that a client expects. ... GTK+, or the GIMP Toolkit, is one of the two most popular widget toolkits for the X Window System for creating graphical user interfaces. ... This article is about the mythical creature. ... A Cocoa application being developed using Xcode. ...


See also

Main article: C# The syntax of the C# is a set of rules which defines how to write and interprete code. ... The Common Language Runtime (CLR) is the virtual machine component of Microsofts . ... Mono is a project led by Novell (formerly by Ximian) to create an Ecma standard compliant . ... Microsoft Visual Studio is Microsofts flagship software development product for computer programmers. ... SharpDevelop is a free and open source IDE for the C#, Visual Basic . ... “Windows” redirects here. ... MonoDevelop is a popular, open source integrated development environment for the Linux platform, primarily targeted for the development of software that uses both the Mono and Microsoft . ... This article is about operating systems that use the Linux kernel. ... Morfik Technology Pty Ltd. ... Baltie character Baltie is a programming language in the first place for learning programming in elementary school and high school i. ... Programming languages are used for controlling the behavior of a machine (often a computer). ... This is a comparison of the C# programming language with the Java programming language. ... The original . ... Cω (pronounced C omega and usually written as Cw or Comega language) is a free extension to the C# programming language, developed by the WebData team in SQL Server in collaboration with Microsoft Research in the UK and Redmond. ... F# (pronounced F sharp) is a functional and object oriented programming language for the Microsoft . ... Objective Caml (OCaml) is a general-purpose programming language descended from the ML family, created by Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy and others in 1996. ... Spec# is a programming language with specification language features that extends the capabilities of the C# programming language with Eiffel-like contracts, including object invariants, preconditions and post-conditions. ... Sing♯ is a concurrent programming language that is a superset of the Spec♯ programming language; in turn, Spec♯ is an extension of the C♯ programming language. ... Boo is an object oriented, statically typed programming language developed starting in 2003, which seeks to make use of the Common Language Infrastructure support for Unicode, globalization and web style applications, while using a Python-inspired syntax and a special focus on language and compiler extensibility. ... Python is a high-level programming language first released by Guido van Rossum in 1991. ... IronPython is an implementation of the Python programming language, targeting . ... Microsoft Corporation, (NASDAQ: MSFT, HKSE: 4338) is a multinational computer technology corporation with global annual revenue of US$44. ... Polyphonic C# is an extension of the C# programming language. ... C++/CLI (Common Language Infrastructure) is the newer language specification due to supersede Managed Extensions for C++. Completely reviewed to simplify the older Managed C++ syntax, it provides much more clarity over code readability than Managed C++. C++/CLI is standardized by ECMA. It is currently only available on Visual... Windows PowerShell, previously Microsoft Shell or MSH (codenamed Monad) is an extensible command line interface (CLI) shell and scripting language product developed by Microsoft. ... “Java language” redirects here. ... C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ... This article is about the Visual Basic language shipping with Microsoft Visual Studio 6. ...

References

  1. ^ In Java 5.0, several features (foreach, autoboxing, varargs, attributes and enums) were introduced, after proving themselves useful in the C# language (with only minor differences in name and implementation). [1][2][3]
  2. ^ Programming language history chart.
  3. ^ Tim Anderson (November 14, 2006). C# pulling ahead of Java - Lead architect paints rosy C# picture. Reg Developer. The Register. Retrieved on 2007-01-20.
  4. ^ LINQ (English). Microsoft MSDN (2007). Retrieved on 2007-08-13.
  5. ^ [4]
  6. ^ Partial Methods. Retrieved on 2007-10-06.
  7. ^ [5]
  8. ^ Computer Language Benchmarks Game (2007-09-08). Retrieved on 2007-09-08.
  9. ^ .Harness the Features of C# to Power Your Scientific Computing Projects (2007-10-29). Retrieved on 2007-10-29.
  10. ^ Cost of array bounds checking -- one experiment (2007-10-29). Retrieved on 2007-10-29.
  11. ^ Microbenchmarking C++, C#, and Java (2005-7-1). Retrieved on 2007-10-29.
  12. ^ See Unified type system
  13. ^ C# FAQ - Boxing and unboxing. Retrieved on 2007-09-08.
  14. ^ Mono Project Roadmap: Mono_1.2. Novell (May 2007). Retrieved on 2007-11-02. “Mono 2.0 will mark the time when the class libraries have complete support for the new features in the 2.0 edition of the framework.
  15. ^ See .NET Framework
  16. ^ See Mono and Microsoft’s patents
  17. ^ http://www.ecma-international.org/publications/standards/Ecma-334.htm
  18. ^ Microsoft C# FAQ. Retrieved on 2006-12-05.
  19. ^ C#/.NET History Lesson (2007-09-07).
  20. ^ http://www.microsoft.com/MSPress/books/imgt/5029.gif
  21. ^ http://www.microsoft.com/presspass/images/gallery/boxshots/web/visual-c-sharp03.jpg
  22. ^ Microsoft F# FAQ.

“Java language” redirects here. ... For each (or foreach) is a computer language idiom for traversing items in a collection. ... In computer science, an object type (a. ... In computer programming, a variadic function is a function of variable arity; that is, one which can take different numbers of arguments. ... Annotation is extra information associated with a particular point in a document or other piece of information. ... In computer programming, an enumerated type is an abstract data type used to model an attribute that has a specific number of options (or identifiers) such as the suit of a playing card (i. ... is the 318th day of the year (319th in leap years) in the Gregorian calendar. ... Year 2006 (MMVI) was a common year starting on Sunday of the Gregorian calendar. ... Current logo of The Register. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... January 20 is the 20th day of the year in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 225th day of the year (226th in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 279th day of the year (280th in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 251st day of the year (252nd in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 251st day of the year (252nd in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 302nd day of the year (303rd in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 302nd day of the year (303rd in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 302nd day of the year (303rd in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 302nd day of the year (303rd in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 302nd day of the year (303rd in leap years) in the Gregorian calendar. ... The title given to this article is incorrect due to technical limitations. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 251st day of the year (252nd in leap years) in the Gregorian calendar. ... May 2007 is the fifth month of that year. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... is the 306th day of the year (307th in leap years) in the Gregorian calendar. ... The Microsoft . ... Mono is a project led by Novell (formerly by Ximian) to create an Ecma standard compliant . ... Year 2006 (MMVI) was a common year starting on Sunday of the Gregorian calendar. ... is the 339th day of the year (340th in leap years) in the Gregorian calendar. ...

External links

Wikibooks
Wikibooks has a book on the topic of
C Sharp Programming
  • Microsoft Visual C# .NET
  • C# Language (MSDN)
  • C# Specification (MSDN)
  • ECMA C# Specifications (version 1.1)
  • ECMA-334 C# Language SpecificationPDF (2.49 MiB)
  • ISO C# Language Specification (for purchase)
  • ISO C# Language Specification (for free)

  Results from FactBites:
 
C# Help: C-Sharp Articles, Forum, Source Code (1141 words)
C# doesn't help matters by allowing you to declare field-like events which are automatically backed by a delegate variable of the same name.
In the C# newsgroup, there was recently (at the time of writing) a discussion about various aspects of constructors.
C# is looking for a few talented individuals to help write articles (columns) for the site.
C#: Information from Answers.com (0 words)
Although C# applications are intended to be economical with regards to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language.
While C and C++ do have 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.
The "sharp" suffix has been used by a number of other.NET languages that are variants of existing languages, including J# (Microsoft's implementation of Java), A# (from Ada), and F# (presumably from System F, the type system used by the ML family).
  More results at FactBites »

 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m