Declaring Generic Types
Let’s take a closer look at how generic types are declared. We’ve already seen the syntax used, using angle brackets < and > to specify a comma-separated list of type parameters. For example, here’s another generic collection type with two type parameters:
class Dictionary<TKey, TValue>
Note: Visual Basic Syntax
When talking about generic types, use the word of to separate the name of the type from its type parameters, as denoted by angle brackets in C#. Visual Basic sounds like plain English language and uses the Of keyword to make this explicit:
Class List(Of T) '...End Class
To construct a type out of the generic type, the same Of keyword is used, followed by the type to be substituted for the type parameter in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access