Free mag vol1 | Page 625

CHAPTER 15  TYPE REFLECTION, LATE BINDING, AND ATTRIBUTE-BASED PROGRAMMING ListMethods(t); ListInterfaces(t); } catch { Console.WriteLine("Sorry, can't find type"); } } while (true); } At this point, MyTypeViewer.exe is ready to take out for a test drive. For example, run your application and enter the following fully qualified names (be aware that the manner in which you invoked Type.GetType() requires case-sensitive string names): • System.Int32 • System.Collections.ArrayList • System.Threading.Thread • System.Void • System.IO.BinaryWriter • System.Math • System.Console • MyTypeViewer.Program For example, here is some partial output when specifying System.Math: ***** Welcome to MyTypeViewer ***** Enter a type name to evaluate or enter Q to quit: System.Math ***** Various Statistics ***** Base class is: System.Object Is type abstract? True Is type sealed? True Is type generic? False Is type a class type? True ***** Fields ***** ->PI ->E ***** Properties ***** ***** Methods ***** ->Acos ->Asin ->Atan 567