1. Multithreading support – While there are many other excellent features of the language, multithreading support is what tops my list. The reason is that the threading mechanism is so much intuitive and easier to implement than many other languages like C++ or even java.
What other language allows you to start a thread, then pause it for 5 seconds, then wait for 7 seconds for it to complete, then instantly terminate it if it doesn't complete and implement this in just 4 lines of code!
Other multithreading features like mutex, lock, Monitor and Event are just as intuitive to use. The end result is that even the average programmer who doesn't have an iron grip over thread programming ends up coding a pretty decent multithreaded solution in C#.
2. Rich Framework Library – Though theoretically C# is a language in its own right, it is almost inseparable with the .NET Framework that it is so closely integrated with. Yet another reason I prefer C# and .NET so much is that it comes pre-bundled with such a comprehensive library (Framework Class Library), that you hardly ever need to look elsewhere to implement any feature you want – be it anything:
- Networking/Socket programming (System.Net and System.Net.Sockets)
- File I/O (System.IO)
- Graphics (System.Drawing)
- Multithreading (System.Threading)
- Remoting (System.Runtime.Remoting)
- Database interaction (System.Data, System.Data.SqlClient)Moreover, the library integrates so well with Windows environment that you never have to worry about performance as it happens in case of Java. You can concentrate entirely on writing your business-logic without worrying about the underlying low-level plumbing of these things which .NET does seamlessly for you.
3. Elegance in language – Especially for someone who admires the compactness and preciseness of the C family of languages and at the same time, is also familiar with the rapid development cycles of Visual Basic language, C# offers an excellent blend of the two worlds. In fact, this was the very purpose when C# was initially designed in 1999. To bring the elegant syntax of C++ to VB programmers, and to bring the RAD nature of VB to C++.
4. Delegates – Though not many people are very fond of this feature, in my humble opinion, the language allows you to do almost everything you can do with pointers in C/C++ without the corresponding risk associated with referencing/dereferencing with pointers. With delegates, you can define a simple prototype for a function, and then use it as a custom datatype that points to any actual function that matches the prototype.