Wednesday, April 16th, 2008
So, shortly after adding the more in depth examples in my last post, I started playing around with the TryParse method in C# to see how “nice” I could make the example code:
public class User
{
public int Age { get; set; }
public DateTime SignupDate { get; set; }
[...]
Value types in the .NET framework tend to have a static TryParse method for converting a string to a typed value. Well, most of them do, the Guid type doesn’t for some reason. The method takes a string and an output parameter for the result.
Output parameters suck and require a local variable to be passed [...]