A Quick Introduction to C# Features
Written by Abhishek Ghosh
C# (pronounced C Sharp) is a multi-paradigm programming language that encompasses functional, imperative, generic, object-oriented (class-based), and component-oriented programming disciplines and was developed by Microsoft as part of the .NET initiative.
C# is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg, the designer of Borland's Object Pascal language. It has an object-oriented syntax based on C++ and is heavily influenced by Java. It was initially named Cool, which stood for "C-like Object Oriented Language."
The most prominent & distinguishing features of C# have been listed below :
- A C# compiler usually targets a Common Language Runtime (CLR).However, the language specification does not state the code generation requirements of the compiler :that is, a C# compiler can very well generate machine code as well.
- C# follows a unified type system called the Common Type System (CTS).A unified type system implies that all types, including primitives such as integers, are subclasses of the System.Object class.
- There are no Global variables or methods, instead all variables and methods muct be declared within a Class.
- Unlike C and C++, Local variables cannot shadow variables of the enclosing block.
- Also unlike C & C++, C# supports a strict Boolean datatype, bool - which cannot be typecasted to and from other data types like int.
- In C#, memory address pointers can only be used within blocks specifically marked as unsafe, and programs with unsafe code need appropriate permissions to run.However, pointers can be stored and manipulated by the System.IntPtr type.
- Managed memory cannot be explicitly freed, but is automatically garbage collected.
- Like Java, multiple inheritance is not supported, although a class can implement any number of interfaces.
- Only safe implicit conversions are performed by default, making C# more typesafe than C++.
- Enumeration members are placed in their own scope.
These are the prime distinguishing features of C#, compared to C or C++.
















Comments