I need to this at runtime. I checked using Reflector and value types line like Int16, for example, should contain
<Serializable, StructLayout(LayoutKind.Sequential), ComVisible(True)> _
Public Structure Int16
Implements IComparable, IFormattable, IConvertible, IComparable(Of Short), IEquatable(Of Short)
Public Const MaxValue As Short = &H7FFF
Public Const MinValue As Short = -32768
End Structure
But the following code is not working
Dim dummyValue = Activator.CreateInstance(GetType(UInt16))
Dim minValue As IComparable = DirectCast(dummyValue.GetType.GetProperty("MinValue").GetValue(dummyValue,
Nothing), IComparable)
any idea how to solve?
EDIT: only for the example I used directly GetType(UInt16) but in real code this part is substituted by an instance of unknown-at-design-time .NET Type