Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / November 2004

Tip: Looking for answers? Try searching our database.

how do i access methods when the .net assembly was loaded with late biding?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 30 Nov 2004 00:23 GMT
how do i access methods when the .net assembly was loaded with late biding?

class Class1
{
public static void Main()
{
 System.Reflection.Assembly SampleAssembly;
 SampleAssembly =
System.Reflection.Assembly.LoadFrom("C:\\SimpleSolutions\\asmload\\asmtoload
\\bin\\Debug\\asmtoload.dll");
 System.Type[] Types = SampleAssembly.GetTypes();
 foreach (System.Type oType in Types)
 {
  System.Console.WriteLine(oType.Name.ToString());
  string strName = oType.Name.ToString();
  System.Object pObj = SampleAssembly.CreateInstance("asmtoload" + "." +
strName);
  //System.Console.WriteLine(pObj.IOCTL("foo")); THIS IS A BUILD ERROR
BECAUSE IOCTL method is not accessible, how to access method if type info of
dynamicaly loaded dll?
  System.Threading.Thread.Sleep(5000);
 }

}
}
Leon Friesema - 30 Nov 2004 00:51 GMT
>how do i access methods when the .net assembly was loaded with late biding?
>
[quoted text clipped - 21 lines]
> }
>}

This example uses GetValue, but you could use GetMethod etc there:

PropertyInfo oInfo = pObj.GetType().GetProperty("MyProperty");
oReturn = (object)oInfo.GetValue(pObj, null);

Leon.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.