There's a method call (which I have anonymized) in a VB class I'm looking at that's like the following:
Dim variableName As ClassName = methodName(Of ClassName)(someOtherArg)
The definition of the method in another file starts with the following:
Protected Function methodName(Of ClassName As {SuperClassName, New})(someOtherArg As someOtherClassName) As ClassName
Generic names aside, what is this syntax doing? It seems like two arguments are being passed to the methodName
method, but the first one has a variable type or something (some sort of polymorphism perhaps?).
Basically, I'm just trying to figure out what this VB syntax is doing, and I've had no luck Googling things like "VB function definition with Of keyword", etc. Thanks.
Of
indicates a generic type or a generic procedure. These are discussed in detail in the F1 help, under Visual Basic / Visual Basic Language Features / Data Types in Visual Basic / Generic Types in Visual Basic and ... / Generic Procedures in Visual Basic.