Answer: Lets say you have to load the assembly from GAC on button click event then you should write following method.
protected void btn_Click(object sender, EventArgs e)
{
AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral,
PublicKeyToken=fbc28d9ca2fc8db5");
Assembly al = Assembly.Load(asm);
Type t = al.GetType("ClassLibrary1.Class1");
MethodInfo m = t.GetMethod("Method1");
str = "reflection - " + (string)m.Invoke(null, null);
MessageBox.Show(str);
}
For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html
Asked In: Many Interviews |
Alert Moderator