PC Review


Reply
Thread Tools Rate Thread

How to Activator.CreateInstance a Type from within an other assembly?

 
 
Matthias Straka
Guest
Posts: n/a
 
      9th Jan 2004
Hi!

I have a project with a Dll and a exe. My dll has a set of functions that
can activate some classes (these classes have all the same interface defined
in the dll). That works fine with classes that are defined inside the Dll,
but when I want to activate a class defined in my exe (which references the
dll) the Type cannot get loaded. Is there any way to
Type.GetType("classname.of.class.in.exe")-Create a Type in a function of the
Dll?

matthias


 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      9th Jan 2004
Matthias Straka <(E-Mail Removed)> wrote:
> I have a project with a Dll and a exe. My dll has a set of functions that
> can activate some classes (these classes have all the same interface defined
> in the dll). That works fine with classes that are defined inside the Dll,
> but when I want to activate a class defined in my exe (which references the
> dll) the Type cannot get loaded. Is there any way to
> Type.GetType("classname.of.class.in.exe")-Create a Type in a function of the
> Dll?


You need to either get the assembly (either by finding it in the
already-loaded assemblies in the AppDomain, or loading it with
Assembly.Load) and call Assembly.GetType, or use GetType with the fully
qualified name of the type, including assembly information.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activator::CreateInstance( unmanaged type ) muriwai Microsoft VC .NET 2 19th Aug 2008 08:51 AM
Difference Between assembly.CreateInstance and System.Activator.CreateInstance John Jenkins Microsoft C# .NET 1 14th Oct 2004 10:00 PM
Activator.CreateInstance with implicit type conversion alp@teletext.co.uk Microsoft Dot NET Framework 6 25th Sep 2004 01:15 AM
Activator.CreateInstance Type problem Frank Pleyer via .NET 247 Microsoft C# .NET 2 5th Aug 2004 09:17 AM
Activator.CreateInstance for new Array Element. Type Problem garak Microsoft C# .NET 4 5th Aug 2004 09:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:12 PM.