Calling Assembly/Dll Method's dynamically Using Asp.Net/C#

Calling Assembly/Dll Method’s dynamically Using Asp.Net/C#(without adding reference)

2.0 framework's we have a option called "Assembly.LoadFrom" helps to load dll files programatically,

See this below simple examble

Assembly assembly = Assembly.LoadFrom(@"C:\Documents and Settings\Sample.dll");
Type local_type = assembly.GetType("GetString"); //Getting Class File Name
Object local_Instance = Activator.CreateInstance(local_type);
string local_string = (string)local_type.InvokeMember("ReturnString", BindingFlags.InvokeMethod, null, local_Instance);
//Just invoking returnstring method,If you are calling any parameterised methods,add params at last parameter here,


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: