Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table Driven Menus
Message
From
19/11/2009 21:32:14
 
 
To
19/11/2009 11:28:21
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01435073
Message ID:
01435724
Views:
53
>Hey Bernard,
>
>Yep, you can do exactly that! The only caveat is that you must instantiate your new DLL using Reflection, which is pretty easy too. I've posted code here many times for this, and I finally wrote it up in my blog a couple of months ago: http://geek-goddess-bonnie.blogspot.com/2009/09/reflection-in-net.html
>
>~~Bonnie
>
Bonnie

Thanks for that link. I have checked it out and can certainly see possibilities.

If you don't mind I will come back to you with some questions on that class as well as the code you posted here earlier. I may seem obtuse but I am just getting my head around this so please bear with me.

Q1. public MyReflectionClass(string assemblyName, string className)

so I could use code like this:
string assembly = "c:\vs2008\projects\MenuAssembly";
string classname = "DynamicMenuClass"
MyReflectionClass oReflection = new MyReflectionClass(assembly, classname);
// call add a menu item method
bool retValue
retValue = oReflection.AddANewMenuItem(para1, para2,paraN);
and the above code will find the c:\vs2008\projects\MenuAssembly.Dll, instantiate the DynamicMenuClass class and then call its method AddANewMenuItem passing the relevant parameters.

I can also use it like this for remote assemblies:
string assembly = "ftp://vs2008projects/MenuAssembly";
or
string assembly = "http://vs2008projects/MenuAssembly";
and provided I have an internet connection it will download the DLL to the cache and the rest of the code will be executed as normal?

And I do not need to have the MenuAssembly.DLL present when I compile my application as it will be found and used based on the parameters I pass it at runtime? If so that's tres cool.


Bernard
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform