473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Creating instance of type withoguht reference to assembly

i know its possible to load an assembly and create instances of the types contained however is it possible to do this withough calling the assembly.createinstance method? but using the Activator class insted? so a reference to each assembly does not need to be maintained??
Nov 16 '05 #1
4 2246
I don't understand all you're saying, but if you want to call a method
without instantiating the class to which the method belongs you delare the
method static.

"Spike" <an*******@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com...
i know its possible to load an assembly and create instances of the types

contained however is it possible to do this withough calling the
assembly.createinstance method? but using the Activator class insted? so a
reference to each assembly does not need to be maintained??
Nov 16 '05 #2
What do you mean by a "reference to each assembly"? You mean a
System.Reflection.Assembly variable reference? Because Activator loads one
of those internally anyways.

-mike
MVP

"Spike" <an*******@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com...
i know its possible to load an assembly and create instances of the types
contained however is it possible to do this withough calling the
assembly.createinstance method? but using the Activator class insted? so a
reference to each assembly does not need to be maintained??


Nov 16 '05 #3
if u set a reference to an assembly in the project u can then use any types within that just like they were in the local project, is it possible to mimic this at runtime? as with the assembly.load u would need to make the destinction between loacal project types and types stored in each assembly as local ones could be created with activator while assembly ones would need the createinstance method of the reference to that indevidual assembly.
Nov 16 '05 #4
In C#, you can do this with Interfaces. Define an interface, and then
program against that. You only need to reference the interface assembly.
Then, at runtime, load up any assembly that has classes that implement the
interface, and instantiate from them. This will provide a strongly bound way
of handling things, and perf will be ok.

Or, go VB's way :) and have everything late bound. However, the perf of a
method call is going to be something like 100 or 1000 times worse.

-mike
MVP

"Spike" <an*******@discussions.microsoft.com> wrote in message
news:70**********************************@microsof t.com...
if u set a reference to an assembly in the project u can then use any
types within that just like they were in the local project, is it possible
to mimic this at runtime? as with the assembly.load u would need to make
the destinction between loacal project types and types stored in each
assembly as local ones could be created with activator while assembly ones
would need the createinstance method of the reference to that indevidual
assembly.


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Elliott | last post by:
I have a 3rd Party DLL that is a Win32 NOT .NET Assembly that is misbehaving. I am trying to isolate it in its own AppDomain. I got to load but can not create an instance. I receive the following...
4
by: Spike | last post by:
i know its possible to load an assembly and create instances of the types contained however is it possible to do this withough calling the assembly.createinstance method? but using the Activator...
0
by: Richard Bell | last post by:
Hosting process is dllhost. Type reference is obtained by a call to System.GetType(). Declaring assembly does not have a strong name and is located in DEVPATH. Assembly is loaded and type reference...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
0
by: Tom | last post by:
Thanks Chris : However, during run time, it show error message "File / component cannot find " during run in Dim asm As =...
2
by: Tom | last post by:
Thanks Chris : However, during run time, it show error message "File / component cannot find " during run in Dim asm As =...
2
by: salportaro | last post by:
Hello: Here is the situation. VB.NET I have several forms and I have a XML file that can start with a particular for for debugging/layout reasons. This is a mdi project. Normaly you would...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
0
by: thehitman | last post by:
I used an article "Creating a Flexible Configuration Section Handler "(http://www.15seconds.com/issue/040504.htm). The Console application works with app.config but with the web.config. The...
1
by: bowser | last post by:
Hello, I have a problem with reflection. I posted it already a month ago, but I had no luck with the answers... Having two variables: Type t; string id; initialized for example as t="Foo"...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.