I want to refer to an enum by the string name of its root. Please note, i wish to refer to the enum, not an enum member.
There are many posts on stackoverflow describing how to refer an enum member by its name (eg How to retrieve an Enum member given its name), but i didn't find any about how to refer to the enum by the name of it's root.
To further clarify;
Enum MyEnumA : Quiet : Noisy : End enum
Enum MyEnumB : Big : Small : Gigantic : End enum
Sub Foo(strAction as string)
' Depending on value of strAction, i want to create a list of either MyEnumA or MyEnumB members
' I know i can't do the following, it's just to make clear the direction i'm wanting to go -
Dim lstMembers As New List(Of CType(strAction,[Enum]))
'....
end function
Following the good suggestions below, i've tried this;
Dim enumType As Type = System.Type.GetType("ExcelInterface.clsBTAnalyseRslts+" & "strAction")
Dim lstFldIndx As New List(Of enumtype) 'Fails to compile this line as doesn't recognize enumtype as defined
Thank you!