Monday, May 26, 2003

C#, .Net and Java

C#, .Net and Java

In June 2000, Microsoft announced both the .NET platform and a new programming language called C#.

C# is a object-oriented language designed for simplicity and performance. The .NET platform is centered around a Common Language Runtime (similar to a JVM) and a set of libraries which can be exploited by a wide variety of languages which are able to work together by all compiling to an intermediate language (IL).

C# and .NET are built around eachother. Some features of C# are there to work well with .NET, and some features of .NET are there to work well with C# (though .NET aims to work well with many languages).


C# is a modern, object-oriented language relying on concepts of with C, C++ and Java. Anders Hejlsberg (of Turbo Pascal and Delphi fame) wrote the specs of the language. .NETis the most well known implementation.

C# code is compiled into machine-independent (and *language-independent*) code which runs in a managed, garbage-collected, execution environment.

C# Supports all object-oriented design principles (encapsulation, inheritance, and polymorphism), the object-oriented design is built into the infrastructure.

C# provides predefined reference types (object and string) and value types (bool, char, decimal, sbyte, short, int, long, byte, ushort, uint, and ulong, float and double).

C# provides a "unified type system". Every type derives from object, be it a primitive type or a class.

C# provides automatic memory management (garbage-collection) like Java.
No C++ pointers, no direct memory manipulation (restricted use is permitted within code marked *unsafe*). Function pointers are emulated with a new concept called *delegates* (deeply bound to the event system).

No C++ multiple inheritance; Interfaces allow single inheritance (like in Java).

Exceptions in C# and Java share a lot of similarities.

The entry point of both C# and Java programs is a *Main* method.
C# uses C++ syntax for inheritance.

Both C# and Java support the concept of synchronized methods and multi-threading.

C# has the equivalent of Java's static nested classes (but no inner classes like in Java).

0 Comments:

Post a Comment

<< Home