About This eBook by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required