Either Activator.CreateInstance or Type.GetConstructor should work.

On 2/6/06, Jekke Bladt <[EMAIL PROTECTED]> wrote:
>
> In my configuration management system, I have the following code:
>
> if(!settingIsCreated)
> {
>         try
>         {
>                 object theSettingObject =
> AppDomain.CurrentDomain.CreateInstanceAndUnwrap(typeAssembly, typeName);
>                 theSetting = (IGroupOneSetting)theSettingObject;
> ...
>
> CreateInstanceAndUnwrap() takes strings as arguments, the name of the
> assembly and the name of the type to create. What is the equivilent if I
> have a System.Type and want to create an instance of it to call to
> through an interface? Obviously, I could extract the assembly name and
> type name from the Type object, but I have to think there's a cleaner
> way.
>
> TIA
>
> --Jekke
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>



--
Eric Means
[EMAIL PROTECTED]
http://www.randomtree.org/eric/

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to