bwells Posted April 12, 2003 Posted April 12, 2003 In my C# application, I want to decide at run time to load a managed DLL based on user input. I have a factory that returns an object that implements an interface, and the kind of object the factory will instantiate should be based on user input, as well as if the factory can find a particular managed DLL in the local directory. If the user enters a particular value, and a matching DLL can be found, then the factory will load the DLL and instantiate an object from the DLL. If the DLL cannot be found, then the factory will load a "default" managed DLL and instantiate a dummy object which implements the expected interface. What is the best way to do what I have described? Bryan Quote
*Gurus* divil Posted April 13, 2003 *Gurus* Posted April 13, 2003 I would use the LoadFrom method of the Assembly class (in the Reflection namespace) and then use its CreateInstance method. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.