Sunday, January 9, 2011

Advantage of c# over c,c++,java


Advantages over C and C++
It is compiled to an intermediate language (CIL) indepently of the language it was developed or the target architecture and operating system
Automatic garbage collection
Pointers no longer needed (but optional)
reflection capabilietis
Don't need to worry about header files ".h"
Definition of classes and functions can be done in any order
Declaration of functions and classes not needed
Unexisting circular dependencies
Classes can be defined within classes
There are no global functions or variables, everything belongs to a class
All the variables are initialized to their default values before being used (this is automatic by default but can be done manually using static constructors)
You can't use non-boolean variables (integers, floats...) as conditions. This is much more clean and less error prone
Apps can be executed within a restricted sandbox
Advantages over C++ and java
Formalized concept of get-set methods, so the code becomes more legible
More clean events management (using delegates)
  • Advantages over java
  • Usually it is much more efficient than java and runs faster
  • CIL (Common (.NET) Intermediate Language) is a standard language, while java bytecodes aren't
  • It has more primitive types (value types), including unsigned numeric types
  • Indexers let you access objects as if they were arrays
  • Conditional compilation
  • Simplified multithreading
  • Operator overloading. It can make development a bit trickier but they are optional and sometimes very useful
  • (limited) use of pointers if you really need them, as when calling unmanaged (native) libraries which doesn't run on top of the virtual machine (CLR)

No comments:

Post a Comment