Re: Activator.CreateInstanceFrom
From: Wayne (MeNotYou_at_community.nospam)
Date: 02/08/05
- Next message: Rutko: "MDI Forms... Some unusual request..."
- Previous message: Sean Hederman: "Re: Adding a Property to a Properties getter and setter"
- In reply to: NuTcAsE: "Re: Activator.CreateInstanceFrom"
- Next in thread: Ignacio Machin \( .NET/ C# MVP \): "Re: Activator.CreateInstanceFrom"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Feb 2005 11:14:14 -0500
Thank you, that worked perfectly (once I figured out where to get the public
token).
BTW, the System.Windows.Forms.Button was just an example, I plan on using
this with my own assemblies. Also since it was already in the gac I figured
it simpler to test with instead of having to first create the assembly
strong name it and then put it in the GAC.
"NuTcAsE" <rao.ritesh@gmail.com> wrote in message
news:1107872991.184207.294840@c13g2000cwb.googlegroups.com...
> First of, if you wanted to create a System.Windows.Forms.Button
> instance you just new it up like:
>
> System.Windows.Forms.Button btn = new System.Windows.Forms.Button();
>
> Soecondly, Activator.CreateXXXX is used for late binding calls. One way
> you can create instances from GAC assemblies is to first load the
> assemly and then call create instance. For ex:
>
> Assembly assm = Assembly.Load ("MyAssembly, Version=1.0.0.0,
> Culture=neutral, PublicKeyToken=[something]");
> MyType type = (MyType) assm.CreateInstance ("MyAssembly.MyType");
>
> That will automatically probe the GAC to check for the MyAssembly
> assembly.
>
> You could also use Activator.CreateInstance function and specify the
> assembly and type name. For GAC assemblies i dont think
> CreateInstanceFrom will work.
>
> NuTcAsE
>
- Next message: Rutko: "MDI Forms... Some unusual request..."
- Previous message: Sean Hederman: "Re: Adding a Property to a Properties getter and setter"
- In reply to: NuTcAsE: "Re: Activator.CreateInstanceFrom"
- Next in thread: Ignacio Machin \( .NET/ C# MVP \): "Re: Activator.CreateInstanceFrom"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|