Navigation

Untitled Page

Monday, June 13, 2011

Reflecting an Assembly (Loading DLL using reflection at runtime in C#)

Reflection is the ability to find out information about objects, the application details (assemblies), its metadata at run-time.

Assembly a = Assembly.LoadFile(@"c:\Business.dll");
Response.Write("Location **** "+a.CodeBase);
Response.Write("
EntryPoint **** " + a.EntryPoint);
Response.Write("
FullName **** " + a.FullName);

Type[] types = a.GetTypes();
foreach (Type t in types)
{
Response.Write("
Type is {0} " + t);
}