LoadFrom Method

  • Thread starter Thread starter Maersa
  • Start date Start date
M

Maersa

Hi All,

When using the Assembly.LoadFrom() method, are all referenced assembly also
loaded into memory ?
I'm trying to get some attribute settings on the assembly but is that
possible without loading it ?

thanks,
 
When using the Assembly.LoadFrom() method, are all referenced assembly also
loaded into memory ?
Yes

I'm trying to get some attribute settings on the assembly but is that
possible without loading it ?

It depends on what you been by 'possible' and 'loading'. You can use the
unmanaged IMetaDataImport COM interface to crawl the assembly metadata
without using reflection. The Tools Developers Guide includes a C++ COM
sample called MetaInfo that is a good starting point.
 
I beg to differ. Assemblies are normally only loaded as and when they
are required - i.e. when a type that resides within the assembly is
first used.

Unless Assembly.LoadFrom() works in a way different to the normal
method of assembly loading employed by the CLR, i think you'll find
that referenced assemblies are loaded on demand, NOT all at once.

Simon
 
That's right. They are implicitly loaded from the same location (assuming
they aren't found in the GAC), but the time of loading is deferred until the
types in the assembly are needed.
 
Back
Top