C# and it’s advantages over other programming languages

C# is a platform-independent, multi-paradigm, managed, type safe, object-oriented programming language.In this blog i tend to list advantages of C# over other programming languages such as C, C++ and Java.

 Advantages over C and C++

  • Compiled to an intermediate language (CIL) independently of the language it was developed or the target architecture and operating system
  • Automatic garbage collection
  • Pointers no longer needed (but optional)
  • Reflection capabilities
  • 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
  • Unexciting 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)
  • Non-boolean variables (integers, floats…) cannot be used as conditions. This is much more clean and less error prone
  • Applications 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
  • 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)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s