Can you pass a "type" as an argument?
Yes. There is System.Type. You may actually want to do a Generic however.
Function SomeFunction(Of T)(obj As Object) As T
'' Magic
End Function
Great Answer - Here is a generic function to do the same:
Public Sub BindListControlToEnum(Of T)(ListCtrl As ListControl)
Dim itemValues As Array = System.Enum.GetValues(GetType(T))
Dim itemNames As Array = System.Enum.GetNames(GetType(T))
For i As Integer = 0 To itemNames.Length - 1
Dim item As New ListItem(itemNames(i), itemValues(i))
ListCtrl.Items.Add(item)
Next
End Sub
Call it like this:
BindDropdownToEnum(Of MyClass.MyEnum)(MyRadioButtonListControl)
you want to use the
function task(of myType)(value as myType) as MyType
''stuff
return value
end function