public static void Main()
var val = (object)"3BB71BB5-02EF-4DF7-94B3-FFF99FFE4AE8";
var t = ParseValue<Guid>(val);
Console.WriteLine("NULL");
Console.WriteLine(">>" + t + "<<");
static T ParseValue<T>(object value)
if (value == null || string.IsNullOrWhiteSpace(value as string))
return (T)Convert.ChangeType(value as string, typeof(T));
var converter = System.ComponentModel.TypeDescriptor.GetConverter(typeof(T));
return (T)converter.ConvertFromInvariantString((string)value);