J
Joe Duchtel
Hello -
I am trying to come up with a generic function that maps integers to a
specified Enum.
I tried ...
Function getEnum(ByVal aEnum as Type, ByVal aValue As Integer) As
Object
.... but when I call getEnum(eEnumA, 1), it is not working with the
interface.
I thought I could do a ...
return CType(aValue, [Type].GetType(aEnum.ToString))
.... to do the mapping but this is not working either. I also
tried ...
return CType(aValue, [Type].GetType("eEnumA"))
.... without any success.
Is there any way to pass a type into a function? How do I use that
type then to map an integer to the Enum that the type defines?
Thanks!
Joe
I am trying to come up with a generic function that maps integers to a
specified Enum.
I tried ...
Function getEnum(ByVal aEnum as Type, ByVal aValue As Integer) As
Object
.... but when I call getEnum(eEnumA, 1), it is not working with the
interface.
I thought I could do a ...
return CType(aValue, [Type].GetType(aEnum.ToString))
.... to do the mapping but this is not working either. I also
tried ...
return CType(aValue, [Type].GetType("eEnumA"))
.... without any success.
Is there any way to pass a type into a function? How do I use that
type then to map an integer to the Enum that the type defines?
Thanks!
Joe