J
jon.rea
Please tell me there is a better way :-D
....
public static bool IsNullableType(Type paramType)
{
return paramType.IsGenericType &&
paramType.GetGenericTypeDefinition() == typeof
(Nullable<>);
}
public static bool IsNullableTypeMatch(Type paramType, Type
argType)
{
return IsNullableType(paramType) &&
argType.IsValueType &&
paramType.FullName.Contains(argType.FullName); //
**********Kludge***********
}
- paramType {Name = "Nullable`1" FullName = "System.Nullable`1
[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]"} System.Type {System.RuntimeType}
- argType {Name = "Int32" FullName = "System.Int32"} System.Type
{System.RuntimeType}
IsNullableTypeMatch(...) -->
Nullable<Int32> with Int32 -- returns true
Nullable<OtherValueType> with Int32 -- returns false
Nullable<Int32> with OtherValueType -- returns false
Any ideas how I can remove my kludge???
Many thanks for any help,
Jon
....
public static bool IsNullableType(Type paramType)
{
return paramType.IsGenericType &&
paramType.GetGenericTypeDefinition() == typeof
(Nullable<>);
}
public static bool IsNullableTypeMatch(Type paramType, Type
argType)
{
return IsNullableType(paramType) &&
argType.IsValueType &&
paramType.FullName.Contains(argType.FullName); //
**********Kludge***********
}
- paramType {Name = "Nullable`1" FullName = "System.Nullable`1
[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]"} System.Type {System.RuntimeType}
- argType {Name = "Int32" FullName = "System.Int32"} System.Type
{System.RuntimeType}
IsNullableTypeMatch(...) -->
Nullable<Int32> with Int32 -- returns true
Nullable<OtherValueType> with Int32 -- returns false
Nullable<Int32> with OtherValueType -- returns false
Any ideas how I can remove my kludge???
Many thanks for any help,
Jon