I am trying to convert a generic collection (List) to a DataTable. I found the following code to help me do this:
// Sorry about indentation public class Col
If Nullable.GetUnderlyingType() given your prop.PropertyType returns a not-null value, use that as the type of a column. Otherwise, use prop.PropertyType itself.
Nullable.GetUnderlyingType()
prop.PropertyType