C#
C# (pronounced C Sharp) is a multi-paradigm programming language that encompasses functional, imperative, generic, object-oriented (class-based), and component-oriented programming disciplines. C# is intended to be a simple, modern, general-purpose, object-oriented programming language. The most recent version of the language is 3.0 which was released in conjunction with the .NET Framework 3.5 in 2007. The next proposed version, 4.0, is in development.
The name "C sharp" was inspired from musical notation where a sharp indicates that the written note should be made a half-step higher in pitch. This is similar to the language name of C++, where the ++ symbol indicates that a variable should be incremented by 1. The Sharp symbol also represents two "++", one over another, telling that the language is an increment of C++.
C# is a modern, object-oriented language that enables programmers to quickly and easily build solutions for the Microsoft .NET platform. The framework provided allows C# components to become XML Web services that are available across the Internet, from any application running on any platform. The language enhances developer productivity while serving to eliminate programming errors that can lead to increased development costs. C# brings rapid Web development to the C and C++ programmer while maintaining the power and flexibility that those developers call for.
The managed, type-safe environment is appropriate for most enterprise applications. But real-world experience shows that some applications continue to require "native" code, either for performance reasons or to interoperate with existing application programming interfaces (APIs). Such scenarios may force developers to use C++ even when they would prefer to use a more productive development environment.
C# addresses these problems by:
- Including native support for the Component Object Model (COM) and Windows.-based APIs.
- Allowing restricted use of native pointers.
With C#, every object is automatically a COM object. Developers no longer have to explicitly implement IUnknown and other COM interfaces. Instead, those features are built in. Similarly, C# programs can natively use existing COM objects, no matter what language was used to author them.
For those developers who require it, C# includes a special feature that enables a program to call out to any native API. Inside a specially marked code block, developers are allowed to use pointers and traditional C/C++ features such as manually managed memory and pointer arithmetic. This is a huge advantage over other environments. It means that C# programmers can build on their existing C and C++ code base, rather than discard it.
In both cases-COM support and native API access-the goal is to provide the developer with essential power and control without having to leave the C# environment.
Following are the major new enhancements in C# 3.0:
- Implicitly typed local variables
- Anonymous types
- Extension methods
- Object and collection initializers
- Lambda expressions
- Query expressions
- Expression Trees
