Monday, January 9, 2012

Top 10 tips and tricks to jazz up your C# business solutions/server products

After the initial lot of tutorials and exercises, when finally I sat down to write my first professional quality C# application, I had to spend some time finding out how routine server related tasks like reading the registry, sending emails, writing to the Windows Event log, getting system information, watching folders etc. are done in .NET.

Fortunately, the rewards of the time spent were fantastic. It was wonderful to see the simplicity and elegance of the C# .NET code doing pretty complicated tasks, against the daunting C++/MFC code I used to write earlier for doing the same things.

So, I decided to compile this list of ready-to-refer tricks.


  1. Sure, you can wade through the MSDN and know all this. But this stuff is for those who are short on time and want ready-to-use simple solutions in a jiffy. You know, the ones whose boss has just yelled �Get me the results! Now!�.
  2. I have chucked out the try-catch blocks and comments from the sample code to reduce the size. Please add these life savers wherever necessary.
  3. When you will run the samples in production environment, please remember that the user-context under which your program is running will require the necessary access right to do certain things. For example, to be able to write to Windows Event Log, you will require the corresponding access rights.
  4. Use this article as a starter to do impressive things with your application, it will get you productive in no time. Once you have some free time, read up more from the MSDN and delve deeper into things.