473,385 Members | 2,014 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,385 software developers and data experts.

Delayed loading dependent assemblies when start an .Net application

Back in COM time, it's possible to use #import statement in cpp to
load COM object type info and use it at coding time. When the
application is started, the underlying COM DLL will not be loaded
until that part of code is called.

Is there a similar thing in .Net (C#) application ?

When I create C# application, I need to add reference to another
assembly if I want to use its classes (I don't want to use reflection
here). But this will also add dependency on that assembly. The
assembly will be loaded when my application starts. Is there a way to
delay the loading of dependent assemblies only when the code using it
is called?

T.I.A.

Mar 6 '07 #1
2 1833
Hi,

<wz*******@gmail.comwrote in message
news:11*********************@64g2000cwx.googlegrou ps.com...
Back in COM time, it's possible to use #import statement in cpp to
load COM object type info and use it at coding time. When the
application is started, the underlying COM DLL will not be loaded
until that part of code is called.

Is there a similar thing in .Net (C#) application ?

When I create C# application, I need to add reference to another
assembly if I want to use its classes (I don't want to use reflection
here). But this will also add dependency on that assembly. The
assembly will be loaded when my application starts. Is there a way to
delay the loading of dependent assemblies only when the code using it
is called?
You could figure out something using like a plug-in pattern, but do you
really need to delay it?

You can always delay the creation of instances until the last moment you
need it, but loading the assembly has not that much of overload to justify
delaying its load.


Mar 6 '07 #2
The CLR will load an assembnly only when it is absolutely necessary. The
delay-loading is built in. (check
http://www.awprofessional.com/articl...&seqNum=5&rl=1 for
a more detailed discussion of CLR loader.) You do not need to do anything
(nor you can).

By adding reference you are not forcing the assembly to be loaded at
startup.
If your code does not use any type in it, it will not get loaded.

<wz*******@gmail.comha scritto nel messaggio
news:11*********************@64g2000cwx.googlegrou ps.com...
Back in COM time, it's possible to use #import statement in cpp to
load COM object type info and use it at coding time. When the
application is started, the underlying COM DLL will not be loaded
until that part of code is called.

Is there a similar thing in .Net (C#) application ?

When I create C# application, I need to add reference to another
assembly if I want to use its classes (I don't want to use reflection
here). But this will also add dependency on that assembly. The
assembly will be loaded when my application starts. Is there a way to
delay the loading of dependent assemblies only when the code using it
is called?

T.I.A.

Mar 6 '07 #3

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

Similar topics

9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
2
by: Guru Prasad | last post by:
Is there a delay involved in unloading assemblies once a virtual directory is "deleted" using IIS Manager ? At times even after the virtual directory is removed i cannot delete the backing physical...
3
by: Nospam | last post by:
I'm trouble shooting my obfuscated program. I'd like suggestions on some tools to help. I'm using vs2005 with delayed signing option from the project settings and reading the hash from a key.snk...
0
by: Ashok Mistry | last post by:
Hi all, I have a problem in loading Assembly dynamically through the Reflection. I want to Load an assembly, say, Main.dll. The Main.dll is dependent on a DLL, say Abc.dll, which is placed in...
6
by: Dan Dorey | last post by:
I actually have two questions here, but I'll start by giving an outline of what I'm trying to do. I'm building an app with a simple plugin architecture (all in the same app domain). I have each...
0
by: npthomson | last post by:
Hi all, This could get a bit complicated but I'll try to be as clear as possible. I've written an application that discovers plugins at runtime using reflection from a subdirectory of the...
2
by: wzhao2000 | last post by:
Back in COM time, it's possible to use #import statement in cpp to load COM object type info and use it at coding time. When the application is started, the underlying COM DLL will not be loaded...
1
by: =?Windows-1252?Q?Tor_B=E5dshaug?= | last post by:
BlankHi, I am having trouble loading assemblies from the database in my ASP.NET app. I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works...
8
by: =?Utf-8?B?TWFyaw==?= | last post by:
We've got a wierd failure happening on just one machine. One part of our product uses a 3rd party search implementation (dtSearch). DtSearch has a native core (dten600.dll), late-bound, and a...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.