How do you determine if a type is nullable using reflection? RRS feed

  • Question

  • I am converting my homegrown ORM library to use .NET 2.0 and nullable types.  We use reflection to do mapping from DB types to C# types.  Now I need to determine, via reflection, if a type is nullable or not.  The best guess I have is to check Type.IsPrimitive and Type.IsValueType and assume that if either are false, I have a nullable type.  The exception would be a struct, which would not be a primitive, but would not be nullable.  Has anyone figured this out yet?
    Friday, June 23, 2006 7:42 PM