Deeper Reflection : Type : Reflection C# Source Code


Custom Search

C# Source Code » Reflection » Type »

 

Deeper Reflection









    

/*
A Programmer's Introduction to C# (Second Edition)
by Eric Gunnerson

Publisher: Apress  L.P.
ISBN: 1-893115-62-3
*/

// 36 - Deeper into C#\Deeper Reflection\Listing All the Types in an Assembly
// copyright 2000 Eric Gunnerson
using System;
using System.Reflection;
enum MyEnum
{
    Val1,
    Val2,
    Val3
}
class MyClass
{
}
struct MyStruct
{
}

public class ListingAlltheTypesinanAssembly
{
    public static void Main(String[] args)
    {
        // list all types in the assembly that is passed
        // in as a parameter
        Assembly a = Assembly.LoadFrom (args[0]);
        Type[] types = a.GetTypes();
        
        // look through each type, and write out some information
        // about them.
        foreach (Type t in types)
        {
            Console.WriteLine ("Name: {0}", t.FullName);
            Console.WriteLine ("Namespace: {0}", t.Namespace);
            Console.WriteLine ("Base Class: {0}", t.BaseType.FullName);
        }
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Reflection
» Type