static void AssemblyLoadUsingReflectionWithoutAddReference()
{
Console.WriteLine("U can load the assemply without add reference, We need to spacife the correct dll path");
//C:\Users\ganapatc\Documents\visual studio 2010\Projects\WorkShop-ConsoleApplication\ClassLibrary1\bin\Debug
Assembly a = Assembly.LoadFrom(@
"D:\DotNet\WorkShop2ndJan2012\WorkShop-ConsoleApplication\ClassLibrary1\bin\Debug\ClassLibrary1.dll");
foreach(var item in a.GetTypes())
{
Console.WriteLine("Get Types");
Console.WriteLine("\t{0}", item.Name);
Console.WriteLine("Get Fields");
foreach(var item1 in item.GetFields())
{
Console.WriteLine("\t{0}", item1.Name);
}
Console.WriteLine("Get Members");
foreach(var item2 in item.GetMembers())
{
Console.WriteLine("\t{0}", item2.Name);
}
}
}In this code we will do loading the assembly using Reflection, Its load only necessary functionality, Its not load all unwanted Resources.