473,396 Members | 1,879 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,396 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 3405
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

3
by: RickN | last post by:
We have a C# remoting application that runs thru the web. Assemblies appear to be loaded from the download cache. Is there any way to have them automatically copied to the GAC and be loaded from...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.