Optimize System.Nullable<T>.GetValueOrDefault().
See discussion at:
http://ericlippert.com/2012/12/20/nullable-micro-optimizations-part-one/
If a variable of nullable value type is initialized with the
default constructor then the [has_value] field will be its
default value, false, and the value field will be default(T).
Since we know that Nullable<T>.value will be the default value when
the default constructor has executed, we can return it directly
instead of checking the has_value field.
-Subproject commit 08448c355b296bebff12b1210fc498594e6dabda
+Subproject commit 3db612102e06332eebebd128cd06be68b03c2f0e
public T GetValueOrDefault ()
{
- return has_value ? value : default (T);
+ return value;
}
public T GetValueOrDefault (T defaultValue)