1

I have some library that have some properties nullable i want to access the underlying data type of the property using Reflection.

System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

How can i get they System.Int32 from RegEx??

If there any another best way to get this then it will be much better.

Niranjan Singh
  • 18,017
  • 2
  • 42
  • 75

1 Answers1

1

Do you really have to go via the string representation? If you've got the property itself, it's easy:

// This returns null if property.PropertyType isn't a Nullable<T>
Type underlyingType = Nullable.GetUnderlyingType(property.PropertyType);
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194