April 2013
Intermediate to advanced
1700 pages
92h 51m
English
The other operation that’s meaningfully defined on a generic parameter T is the typeof expression that gets the System.Type object describing, at runtime, the type that was supplied for the type parameter T:
Type t = typeof(T);var methods = t.GetMethods();
Because you’ll be reading a whole chapter about reflection (Chapter 21, “Reflection”), we defer further discussion about System.Type until later. Practically speaking, you should rarely have to use the typeof(T) trick.
Read now
Unlock full access