Search
Solutions
Services
 
Home
Our Team
Portfolio
India Outsourcing
Technical Expertise
Process
Pricing
FAQ’s
Featured Customers
Downloads
Corporate Profile
Read | Download PDF

Whitepapers
Read | Download PDF

 
 

C# - Premier Language of the .Net
Archives > C#


By Ramesh B

Microsoft announced, in June 2000, its intention to introduce C#(pronounced 'C Sharp', a new programming language that is a part of its .NET suite. C# aims at combining the simplicity and high productivity of Visual Basic which the powerful features of C++. It is rooted in the C and C++ family tree of languages. People predict that the new language, considered to be the best from Microsoft, will play an important role in development.

Every product service concept has, generally speaking, life cycle consisting in phases of nascence, acceptance, wide adoption and decline (in the absence of any intervention, be it enhancing or negating, at any of the phases to influence the future course). There is natural excitement, therefore about a new language being touted as a potential alternative to the established one. The article is more of the sneak preview to satisfy the inquisitive urge to compare C# as a premier language.

Features of C#

Object Oriented
The buzzword for programmers across the globe is Object-oriented and this is probably the first thing that we must look in a new programming language. C++ as most of us know was an object-oriented development of the C language. In C#, encapsulation, inheritance and polymorphism, the three most important principles of Object-Orientation have been preserved. One thing to note is that there are not more global function, variable, or constants. Everything must be encapsulated inside a class. This makes a C# code more readable and also reduces naming complex. C# class members can be declared as private protected public internal or static, thus facilitating complete control over their encapsulation.

Garbage collection
Garbage collection is another powerful feature, which is very useful for memory management. The garbage collector governs all managed objects and they are based when they are no longer referenced. Java and C# support garbage collection. However, garbage collection is not a feature of C# per se, but a feature of the .NET runtime that C# uses.

Type-Safe
When you had a pointer in C++, you were free to cast it to any type such as casting and int* (int pointer) to a double* (double pointer). C# implements strictest type safety to protect itself and the garbage collector. Therefore, you must abide by a few ruler in C# with regard to variables.

Versionable
Over the past few years every programmer has had to deal, at least once, with what has been known as 'DLL Hell'. The problem stems from the fact that multiple applications install different versions of the same DLL to the computer.

Sometimes, older applications happily work with the newer version of the DLL; however, most of the time, they break. Versioning is a real pain today. C# does its best to support this versioning.

One of the primary goals of the .NET is to solve the versioning problem, which enables the developer to specify version dependencies b/n different pieces of software, and the .NET enforces those rules at runtime.

Namespaces
C# works with a hierarchical namespace model. Namespaces are C# program elements designed to help organize programs. Objects are grouped into namespaces and a particular namespace has to be included in a program to access the classes and objects within it. Implementing namespaces helps in avoiding name clashes b/n two blocks of code. Moreover, namespaces can make a program reusable - enclose the program in a namespace and declare the classes as public to make them accessible outside that particular namespace.

Indexes
Another feature of C# class is indexes which make it possible to access value in a class with array like syntax. And if you want clients to note when something happens in your class, you can have them subscribe to events.

Delegates
A delegate encapsulates a method which a certain signature. Basically, delegates are the type-safe and secure version of function pointers (call back functionality). You can encapsulate both static and instance methods in a delegate instance. Delegates are C#'s equivalent to a function pointer prototype.


Data-types
C# is a type language that has defined rules that determine what operations are legal on a variable of a particular type to maintain the integrity of the data stored in it. C# has 3 data types which are,

  • Value types
  • Reference type and
  • Boxing and Unboxing.

C# has Simple type consisting of integral type, boolean type, char type, floating-point type, decimal type, struct type and enumeration type.

C# Reference type consists of Object type, Class type, Interfaces, Delegates, String type, and Arrays.

Security
It is an important topic, especially so because today's code comes from multiple sources, including the Internet.

By Default code operates in safe mode where no pointers are allowed. Type safety pays off. However if you need pointers, you can still use them via unsafe code - and no marshaling is involved in calling their unsafe code.

Trojans, viruses and Web spooling are the dreaded terms in the Internet world. In C# unsafe code must be explicitly declared with the modifier unsafe to prevent accidental features. Moreover, the compiler and execution engine work hand in hand and ensure that unsafe code is not executed in an untrusted environment.

Exception handling and debugging
One big advantage of .NET is that exception handling is standardized across languages. An exception thrown in C# can be handled in visual basic client.

C# offers the conditional key word to control the flow and to make the code more readable. C# also provides integral support for throw, try, catch and try …finally. C++ programmers could use macros to do the same, but C# has an improvised intrinsic model.

Ongoing research
Generics/Templates: The first C# release does not have generics or templates. The C# design team is working with Microsoft research to introduced generics into the language.

Deterministic Destruction: As mentioned earlier in the article the introduction of this feature implies some significant changes to both the language and the runtime. This is a raging debate on all the discussion columns on C#. Even if the C# design team decided to make changes here, it is doubtful if they will replicate C++'s behaviour in its entirety

Conclusion
What remains to be seen I what changes C# will bring into the programming world. Microsoft's influence in the IT domain might be of some consequence in this regard. Connoisseurs of languages will do well, to keep a sharp eye on Microsoft's next move.

So, C# is the modern language for a modern world. "C# provides the productive, modern object oriented language that simplifies development while staying true to the programming heritage of C++, C# is definitely something you want to look at".


 

 
Related Links on building an Online Community:

 
  Newsletter | Site Map | Development Scenarios | Partners | Careers | Archives
Copyright 2004 Stylusinc.com
  Links | Privacy Policy