I’m strictly looking for a language conversion here of this:
List<?>
I already have a work around I’m just surprised that I can’t find the vb.net equivalent of a variable type of a “raw” generic list that takes a wild card.
Java’s mechanism here enables you to reference a list regardless of what T is.
Java even enables you to go further and do things like:
List<? extends Number>
List<? super Double>
I tried:
List(Of )
and that did not work. That only seems to work inside the GetType function.
See Generic Types in Visual Basic (Visual Basic) on MSDN. What you’re looking for is called a Type Constraint. You’ll have to combine that with a declaration on a method or class that performs the restriction that you want.
To accept any type you can do:
Or to restrict it, for example, to a value type, you can do:
What you’re looking for is a purely generic property which isn’t allowed in the .Net Framework. The code below will not compile.
The closest you can get is: