April 2013
Intermediate to advanced
1700 pages
92h 51m
English
In our discussion about generic types, you learned how a generic type is used repeatedly. Let’s concentrate on the phonebook example a bit more:
var numbers = new Dictionary<string, int> { { "Bart", 911 }, { "John", 119 }};
In the preceding code, we’re making a constructed generic type (sometimes referred to as a closed generic type) by substituting the TKey type parameter for string and the TValue type parameter for int. As you expect from a great development environment, Visual Studio provides IntelliSense when supplying types for generic type parameters, as shown in Figure 15.9.
FIGURE ...
Read now
Unlock full access