From: Phil on 2 Mar 2010 07:12 Take a look at Activator.CreateInstance "SnapDive" <SnapDive(a)community.nospam> wrote in message news:o64po5t04ta4jg431efsudc46vi78bbe1b(a)4ax.com... > > I have a string containing the Type of a fully-qualified class. The > class and all others like it implement a particular Interface. I would > like to create a new instance of this Type, populate it, and then send > it somewhere. My Type is known at runtime. Using Reflection and .NET > 3.5, what is the best way to do this? > > non-working pseudo-code > > string class="my.super.class"; > foreach Type in someassembly.dll > { > if Type.name = class > { > IKnownInterface someI = ReflectionMagic.create(class); > } > DoSomeWork( someI ); > } > > Help? > > Thanks. > >
|
Pages: 1 Prev: elevating user to administrator Next: Debugging a Class Library used in a Web Application |