The BCL team published an analysis of the fastest way to get a value out of a nullable type. The preferred method is:
int? nullableInt = GetMyNullableValue();
int value;
if (nullableInt.HasValue)
{
value = nullableInt.GetValueOrDefault();
}
The common method is:
int? nullableInt = GetMyNullableValue();
int value;
if (nullableInt.HasValue)
{
value = nullableInt.Value;
}
In their analysis using the Value property in the scenario above is 16% slower than using the GetValueOrDefault method, because Value also calls HasValue, so it gets called twice.
My take? I thought you properties for fast access. Why is the method faster than the property? It doesn't make a lot of sense to me. Like StringBuilder vs. String, I would recommend using Value except for tight loops where the performance matters. Otherwise, people will be wondering what the default value has to do with anything. Answer? null (or Nothing in Visual Basic) :-)