C#

System.Nullable vs. TryParse Revisited

Navigating TryParse with nullable types

As a follow-up to my system.nullable vs. tryparse post, I've posted the source code for the nullable parser. I use this code in nearly all of my projects to help with parsing nullable values. It makes parsing nullable objects much easier, and mirrors the functionality of the existing TryParse methods that the framework has made us accustomed to.

System.Nullable vs. TryParse

Navigating TryParse with nullable types

I've been working on some code tonight and needed to use the trusty struct.TryParse methods available in the core framework.  Unfortunately, the built in TryParse methods choke on nullable types.  After a frightfully short google search I ran across a blog entry from Steve Michelotti describing his approach to writing his own TryParse object for nullable types.  Its pretty sweet though it didn't meet a specific need that I had, specifically the ability to have the result parameter have its value set to null in cases where the string passed in is in fact null (or empty).