Please tell me there is a better way :-D
....
public static bool IsNullableType( Type paramType)
{
return paramType.IsGen ericType &&
paramType.GetGe nericTypeDefini tion() == typeof
(Nullable<>);
}
public static bool IsNullableTypeM atch(Type paramType, Type
argType)
{
return IsNullableType( paramType) &&
argType.IsValue Type &&
paramType.FullN ame.Contains(ar gType.FullName) ; //
**********Kludg e***********
}
- paramType {Name = "Nullable`1 " FullName = "System.Nullabl e`1
[[System.Int32, mscorlib, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9]]"} System.Type {System.Runtime Type}
- argType {Name = "Int32" FullName = "System.Int 32"} System.Type
{System.Runtime Type}
IsNullableTypeM atch(...) -->
Nullable<Int32w ith Int32 -- returns true
Nullable<OtherV alueTypewith Int32 -- returns false
Nullable<Int32w ith 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.IsGen ericType &&
paramType.GetGe nericTypeDefini tion() == typeof
(Nullable<>);
}
public static bool IsNullableTypeM atch(Type paramType, Type
argType)
{
return IsNullableType( paramType) &&
argType.IsValue Type &&
paramType.FullN ame.Contains(ar gType.FullName) ; //
**********Kludg e***********
}
- paramType {Name = "Nullable`1 " FullName = "System.Nullabl e`1
[[System.Int32, mscorlib, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9]]"} System.Type {System.Runtime Type}
- argType {Name = "Int32" FullName = "System.Int 32"} System.Type
{System.Runtime Type}
IsNullableTypeM atch(...) -->
Nullable<Int32w ith Int32 -- returns true
Nullable<OtherV alueTypewith Int32 -- returns false
Nullable<Int32w ith OtherValueType -- returns false
Any ideas how I can remove my kludge???
Many thanks for any help,
Jon
Comment