C#, the Java of Microsoft
The C# language is easier to use than C++, however, it require the runtime of .NET
to run programs. You can convert you C++ code with no difficulty.
It keeps most Java improvement, a clear object orientation, a garbage collector.
C# was designed by Microsoft (tm) for its new .NET platform as an alternative to Java, inspired (as it) by C++, by Java and various other
languages.
Many other languages are
implemented on this platform also. This include C++, Pascal, Python, Java, and lot of others, even
Cobol and Fortran.
You can mix languages on the .NET platform and use C#
along with any language, they can share their objects.
Uncertain future
The future of the language is not well defined. One could have thought that its implementation in Silverlight, once viewed as the platform of the future for Web and mobile apps, will make it an essential language. Then Microsoft moved to Metro, new platform on Windows 8 using HTML 5 and Silverlight (along XAML and an upcoming system).
C# seems not to be viewed by Microsoft as the language for immersive apps. It remains at least a langage for legacy desktop apps and server-side.
JavaScript in version 5 will include classes and so will facilitate the achievement of important applications, it will can replace a language of applications.
Features and differences with C++
C# compiles into intermediate language, the CIL (Common Intermediate Language), which runs on a virtual machine, the CLR (Common Language Runtime). It is the implementation of the CLI, the common language infrastructure.
- Structs, coming from C++, are here special objects passed by value.
- A property allows to use methods as one uses variables.
- The foreach() construct allows to scan arrays.
- Delegate replaces pointers on functions used by C.
- Operators overloading exists but for the "=" one.
- It is fully object oriented, even primitive and constants are object.
- Indexers are invisible methods to access arrays with security.
- The language may access the native environment, unlike Java.
- The -> operator of C++ is replaced by a dot.
- The managed mode allows compatibility for a C++ program.
An important difference with Java is that every Java class is stored in a separate file, which is not a constraint of C#.
Sample code
Merging two strings and displaying the characters.
string s = "demo" + "trail";
foreach (char c in s)
{
System.Console.WriteLine(c);
}
Tools and documents
- Microsoft. Official site for .NET and C#.
- Mono
.NET compatible platform including a C# compiler.
- Visual
C# Express
It is a true RAD (Rapid Application Development) by Microsoft. Windows or console applications or libraries.
A CSharp compiler is included. - Silverlight
Using XAML on the Web. - Turbo
C#
RAD tool, with visual interface and predefined widgets, free even for commercial software building. Makes use of the Microsoft compiler. - XNA
Game development tool based on C#. - Script#
Convert C# to JavaScript.
| Tweet |
|