c# Programming Glossary: nullable.getunderlyingtype
How to sort databound DataGridView column? http://stackoverflow.com/questions/1699642/how-to-sort-databound-datagridview-column null prop.PropertyType.IsValueType Type underlyingType Nullable.GetUnderlyingType prop.PropertyType if underlyingType null interfaceType underlyingType.GetInterface..
Convert.ChangeType() fails on Nullable Types http://stackoverflow.com/questions/3531318/convert-changetype-fails-on-nullable-types .GetProperty modelProperty if property null Type t Nullable.GetUnderlyingType property.PropertyType property.PropertyType object safeValue..
How to check if an object is nullable? http://stackoverflow.com/questions/374651/how-to-check-if-an-object-is-nullable type typeof T if type.IsValueType return true ref type if Nullable.GetUnderlyingType type null return true Nullable T return false value type But..
Getting 'basic' datatype rather than weird nullable one, via reflection in c# http://stackoverflow.com/questions/5174423/getting-basic-datatype-rather-than-weird-nullable-one-via-reflection-in-c-sha
.NET - Convert Generic Collection to DataTable http://stackoverflow.com/questions/701223/net-convert-generic-collection-to-datatable you'll need to lift them to the non nullable form using Nullable.GetUnderlyingType and perhaps change a few null values to DbNull.Value ... Change.. when adding the columns to be table.Columns.Add prop.Name Nullable.GetUnderlyingType prop.PropertyType prop.PropertyType And it works. is the null..
Looking for a fast and easy way to coalesce all properties on a POCO http://stackoverflow.com/questions/7422861/looking-for-a-fast-and-easy-way-to-coalesce-all-properties-on-a-poco var propType prop.PropertyType if propType.IsValueType Nullable.GetUnderlyingType propType null continue int instead of int etc skip il.Emit..
How can I fix this up to do generic conversion to Nullable<T>? http://stackoverflow.com/questions/793714/how-can-i-fix-this-up-to-do-generic-conversion-to-nullablet static T To T this IConvertible obj Type t typeof T Type u Nullable.GetUnderlyingType t if u null if obj null return default T return T Convert.ChangeType..
Setting properties of an object through reflection with different properties types http://stackoverflow.com/questions/862783/setting-properties-of-an-object-through-reflection-with-different-properties-typ if thisPropertyValue null Type underlyingType Nullable.GetUnderlyingType propertyType thisPropertyValue Convert.ChangeType thisPropertyValue..
|