Browse by Tags

All Tags » C# » Tips & Tricks (RSS)

My Faq on "hashtable lookups for struct types" is published at http://blogs.msdn.com/CSharpFaq

Check out http://blogs.msdn.com/csharpfaq/archive/2006/03/20/556192.aspx for a FAQ on Hashtable lookup for value types.

Guidelines on clean up code

Many a times, we use the catch block inside the try catch block for our clean up code. Something like try { // Do something } catch { // work failed, clean up code here } Rather than the above approach of using the catch block, it would be nicer to use...
Posted by Vipul Patel | with no comments

.NET Tip - Getting logged in user name in ASP.NET web application

Frequently we desire to autopopulate some fields on our web form with the current logged in username and domain. How to get that information? Well, User.Identity.Name comes to the rescue. Set the text property of the field to User.Identity.Name and it...

Visual Studio Tip of the day - Refactoring - Extracting method

You notice that you have a chuck of code which could easily be transitioned to a new function. How tdo you do that? Again, Visual Studio Refactoring menu comes to the rescue. Suppose you have the following code in your function public void Myfunc() {...
Posted by Vipul Patel | with no comments
Filed under: , ,

How to: Determining programmatically if DLL is registered

Here is a C# code snippet to determine if a particular DLL is registered or not. [DllImport("kernel32")] public extern static int LoadLibrary( string lpLibFileName); [DllImport("kernel32")] public extern static bool FreeLibrary( int hLibModule); public...
Posted by Vipul Patel | with no comments
Filed under: , , ,