Featured Posts

Tools I use Visual Studio Addins 1. GhostDoc This is a free addin that automatically generates the XML comments for your code. Click on the method/field name and press Control + Shift + D and it generates the XML...

Readmore

New UI for my website! Hello, I have modified the UI of my website and have moved all my blogs from my old blog site. There were few comments from my site visitors and friends that site was not rendering properly in Google Chrome...

Readmore

Setting custom toolwindow icon for Visual Studio add-in I recently completed a minor update to my Favorites Menu for Visual Studio add-in. The new installer is already put under ‘My Development’ section on my site. The update includes a minor bug fix...

Readmore

Set devenv to run your Visual Studio version Recently I found out that my wife has VS 2003, VS 2005 and VS 2008 all installed in her laptop. It is our usual practice that we hit devenv in Windows run menu to open our Visual Studio IDE. So whenever...

Readmore

  • Prev
  • Next

Singleton Pattern vs. Static Class

Posted on : 13-11-2008 | By : Utkarsh Shigihalli | In : .net, c#, programming

0

The singleton pattern ensures a class has only one instance, and provide a global point of access to it.

There is a nice article about choosing between Singleton pattern and the static class here with examples.

DebuggerStepThrough attribute

Posted on : 06-11-2008 | By : Utkarsh Shigihalli | In : .net, c#, programming

0

Pedram Rezaei has written how we can let .NET debugger know, not to step in to certain elements of your program with the help of DebuggerStepThroughAttribute.

Read it here

TypeCode enum in C#

Posted on : 09-06-2008 | By : Utkarsh Shigihalli | In : .net, c#, development

0

Recently, one of my friend digged in to metadata of TypeCode enum type and found out that, it does not have value 17 in it.

typecode

Even I was surprised to see this, and wanted to know the reason behind value 17 missing from the enumeration.

I googled and found a link to blog which explains, why the value 17 has been missed from the enum.

From the author:

We’ve had this “hole” in the TypeCode enum since October of 2000, and I can’t find an older set of bits. But, I’m sure that comment in IConvertible is right – this used to be TimeSpan. For TimeSpan, it’s possible we thought it would be interesting for a while, then we realized that frankly not that many people need to convert a Decimal to a TimeSpan, then removed it.

You might ask why we didn’t “fix” the enum when we removed whichever of these values we had originally added. It turns out that whenever we have a breaking change internally, we need to recompile all the code that might possibly depend on the removed or changed public surface area. For us, that would mean rebuilding everything that might have referred to TypeCode.String, whose value would have changed from 18 to 17. While we do go through that process internally in DevDiv, it is costly & painful for us.