S
Simon Woods
Hi
I have this recursive function and I want to walk the inheritance
hierarchy to set field values ....
the generic T is constrainted as the base class of the inheritance hierarchy
Friend Shared Function InjectFieldValues(ByVal p_def As T,
ByVal p_properties As PropertyMaps) As T
' .... reflection to set field values at this inheritance tier ...
'walk inheritance hierachy to set field values on inherited tiers
If p_def.GetType.BaseType IsNot Nothing Then
p_def = InjectFieldValues(CType(p_def, p_def.GetType.BaseType), _
p_properties)
End If
Return p_def
End Function
The CType complains that p_def.GetType.BaseType is not defined - why?
when I don't try and cast but simply look at the p_def.GetType.BaseType
at runtime, it's fine.
Is there another way to walk the hierarchy?
Thx
S
I have this recursive function and I want to walk the inheritance
hierarchy to set field values ....
the generic T is constrainted as the base class of the inheritance hierarchy
Friend Shared Function InjectFieldValues(ByVal p_def As T,
ByVal p_properties As PropertyMaps) As T
' .... reflection to set field values at this inheritance tier ...
'walk inheritance hierachy to set field values on inherited tiers
If p_def.GetType.BaseType IsNot Nothing Then
p_def = InjectFieldValues(CType(p_def, p_def.GetType.BaseType), _
p_properties)
End If
Return p_def
End Function
The CType complains that p_def.GetType.BaseType is not defined - why?
when I don't try and cast but simply look at the p_def.GetType.BaseType
at runtime, it's fine.
Is there another way to walk the hierarchy?
Thx
S