Mega Code Archive

 
Categories / C# Book / 09 Reflection
 

0630 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); } }