Generic Procedures

A generic procedure is a procedure defined with a minimum of one type parameter. This lets the caller adapt the data types to the conditions each time it calls the procedure.

A procedure is not generic only because it is in a generic class or structure. To be generic, the procedure must have a minimum of one type parameter, but that ignores the usual parameters. A generic class or structure can contain procedures that are not generic. And a class, structure, or module that is not generic can contain generic procedures.

A generic procedure can use its type parameters in its usual parameter list, in its return type, and in its executable code.

Type inference

TODO

Example

Sub Swap[Type] ByRef a As Type, ByRef b As Type
    Dim t As Type = a
    a = b
    b = t
End Sub

See also