Listing A – ClassInfo
using System.Reflection;
using System;
 
public class ClassInfo
{     
 
      public static void Main(string[] args)
      {
             if (args.Length == 0)
             {
                    Console.WriteLine("Usage: ClassInfo nameofclass\nWhere: nameofclass is a fully qualified .NET class name.");
             }
             else
             {
                    GetClassInfo(args[0]);
             }
             Console.ReadLine();
      }
      
      public static void GetClassInfo(string ClassName)
      {
             //get the type corresponding to the class
             Type t = Type.GetType(ClassName);
             
             //we're not interested in primitives or value types
             if (t.IsClass)
             {
                    Console.WriteLine("{0} base class {1}", t.FullName,t.BaseType);
                    
                    //Print out some class level info
                    if (t.IsAbstract)
                          Console.Write("Abstract ");
                    if (t.IsPublic)
                          Console.Write("Public ");
                    if (t.IsSealed)
                          Console.Write("Sealed ");
                    if (t.IsSerializable)
                          Console.Write("Serializable ");
                    
                    //get the library name and assmebly info
                    Console.WriteLine("\nContained in {0}", t.Namespace);
                    Console.WriteLine("Assembly info is: \n{0}", t.Assembly);
                    
                    //Get an array representing the methods of this class
                    MethodInfo[] methods = t.GetMethods();
                    foreach (MethodInfo m in methods)
                    {
                          //get some info about each method
                          Console.WriteLine("\nMethod:");
                          Console.Write("\t");
                          if(m.IsPublic)
                                 Console.Write("Public ");
                          if(m.IsPrivate)
                                 Console.Write("Private ");
                          if(m.IsAbstract)
                                 Console.Write("Abstract ");
                          if(m.IsConstructor)
                                 Console.Write("Constructor ");
                          if(m.IsFinal)
                                 Console.Write("Final ");
                          
                          Console.WriteLine("{0} {1}", m.ReturnType.ToString(),m.Name);
                          
                          Console.WriteLine("Parameters:");
 
                          //if this method has any parameters,
                          //list out some info about each
                          ParameterInfo[] pi = m.GetParameters();
                          if(pi.Length == 0)
                          {
                                 Console.WriteLine("\tNone");
                          }
                          else
                          {
                                 foreach(ParameterInfo p in pi)
                                 {     
                                        Console.Write("\t");
 
                                        if (p.IsOut)
                                               Console.Write("out ");
                                        Console.WriteLine("{0} {1}", p.ParameterType.ToString(), p.Name );
                                 }
                          }
                    }      //foreach
             }
             else
             {
                    Console.WriteLine("{0} is not a reference type.", ClassName);
             }
      }//method
      
}//class