Browse by Tags

All Tags » 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

Application which does not create an entry in Add/Remove Programs

Do you want your application not in appear in Add/Remove Programs list? If yes, ARPSYSTEMCOMPONENT property of the Windows Installer SDK helps. Setting this property to 1 prevents the installed application to be displayed in the Add/Remove Programs List...
Posted by Vipul Patel | 1 comment(s)
Filed under:

.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: , ,

Visual Studio Tip of the day - Refactoring - Changing variable names

Did you mistype a variable/function/property only to realize it in the code review and are frustrated over the time you will need to spend to correct it across the whole source code? Visual Studio 2005 has a new feature called refactoring by which you...
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: , , ,

Visual Studio Tip of the day - Format Document

Time and again we write code and our brackets get out of visual sync, i.e. they no longer appear as a coherent set even though they may be. In Visual Studio, there is a feature known as Format Document which will align the code systematically. It can...
Posted by Vipul Patel | 2 comment(s)
Filed under: ,

Visual Studio Tip of the day - Bookmarks

How often do you wish that you could put a mark at a particular location in your source code and then switch to that point with a simple click? With Visual Studio , you can do that with the help of bookmarks. A bookmark is a virtual placeholder which...
Posted by Vipul Patel | with no comments

Incremental search - VS2005

One of the lightly used features of VS2003 and VS2005 continue to be Incremental search. Developers usually know the text which they are searching for. Due to lack of awareness of the VS editor features, I have seen many a developers editing code in TextPad...
Posted by Vipul Patel | with no comments