Assembly Reflection

To inspect type information and not instantiate or invoke types, load the assembly into a reflection-only context:


using System;
using System.Reflection;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        Assembly a = Assembly.ReflectionOnlyLoadFrom(@"e:\demo\mylib.dll"); 
        Console.WriteLine(a.ReflectionOnly);  // True

        foreach (Type t in a.GetTypes()) 
            Console.WriteLine(t);

    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.