Underrated .NET Classes

Inspired by Bill Simmon’s list of underrated movies, here’s my list of the top eight underrated classes in the .NET framework.

5. System.Diagnostics.Debugger

Common question in class: How come when you press Ctrl-F5 to start an app, you receive the “press any key to continue” message, but when I hit F5 the program just exits out?”  I have no idea why when the debugger is attached you don’t receive that message.  Perhaps they are assuming that when the debugger is attached, you’ll be using it.  Therefore the program probably won’t exit without you being able to check things out.  Anyways, try adding this to the bottom of sub main:

If System.Diagnostics.Debugger.IsAttached Then
Console.Write("Press enter to continue...")
Console.ReadLine()
End If

Good times.

4. System.Drawing.ColorTranslator

How many of you have written code to convert RGB to html or vice versa?  Me too.  Check out ToHTML or the FromHTML functions in this class.

3. System.Web.Security.FormsAuthentication

Has to be mentioned solely for having what careful research has shown to be one of the longest names in the .NET framework: HashPasswordForStoringInConfigFile (34 characters).  Well, I’m lying.  System.Data.SqlTypes.SqlString has a method called CompareOptionsFromSqlCompareOptions weighing in at 35 characters, but I don’t think many people have ever used it (my guess on the number of people who have used it: 5). A couple of private methods also weigh in at 40 characters too: ResolveVariantTypeConverterAndTypeEditor and PossibleIncrementPeakPoolConnectionCount. 

Special mention must also be given to System.Windows.SystemInformation for having many properties around 30 characters long. 

2. The Microsoft.VisualBasic Namespace

This one would also be pretty high up on the overrated namespace list too.  Nonetheless, with all the grief and debates on why using this is inherently evil or super awesome, sometimes it is just easier to call the Asc or IsNumeric function and be done with it.  Then on the other hand, if I see anyone else using InStr to search through strings I’m just going to snap.  As a side note, I had a couple of guys asking about the “enster” function.  Took me a second they were talking about InStr, which I always thought meant InString.  But I digress.

1. System.Globalization.DateTimeFormatInfo

One of my favorites.  Simply get a reference to a CultureInfo’s DateTimeFormat, and you have all kinds of useful functions at your finger tips.  Want to get a list of all the months for a particular culture, it’s here.  How about the weekdays?  Also here.  Special mention must be given to the NumberFormat class too, but I think most people will be content using the Format object to take care of the heavy lifting for them.

I was going to make this a top eight list, but my print job is done, and I'm ready to get home.  If anyone needs an expert at fixing paper jams in a Sharp AR-337, I'm your man.  Took care of seven of them today.

4 Comments

Comments have been disabled for this content.