O'Reilly logo

C# 5.0 Unleashed 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

Getting the Type’s Reflection Info Object

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.

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