dynamically creating an instance of a class

J

James Zhuo

Hi all

I am building a plugin application. My application is
required to search for new pluggins within a predefined
directory and invoke it by creating a new instance of what
ever the pluggin is and bring up the main form associated
with that particular plugin. How would I do that?

I have checked up something call appdomain, not totally
sure how to use it. Is there any resources that i may be
able to look up on? or am i on the right track at all?
There are all these methods called CreateInstance,
CreateInstanceAndUnwrap, CreateInstanceFromAndUnwrap,
what's the difference between all these?

thanx

James
 
H

Herfried K. Wagner [MVP]

* "James Zhuo said:
I am building a plugin application. My application is
required to search for new pluggins within a predefined
directory and invoke it by creating a new instance of what
ever the pluggin is and bring up the main form associated
with that particular plugin. How would I do that?

I have checked up something call appdomain, not totally
sure how to use it. Is there any resources that i may be
able to look up on? or am i on the right track at all?
There are all these methods called CreateInstance,
CreateInstanceAndUnwrap, CreateInstanceFromAndUnwrap,
what's the difference between all these?

Have a look at this sample:

<http://www.codeproject.com/csharp/livecodedotnet.asp>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top