[Reflection] Can find types without loading assemblies?

  • Thread starter Thread starter Leonardo Spina
  • Start date Start date
L

Leonardo Spina

I would need to iterate through all the assemblies I can find on mi pc and
use only those which implement a specific interface I wrote.
The only way I found is to load one by one all the assemblies I find and
iterate through types and interfaces.
It works but memory usage hugely increases!

Is there another way to do this? (at least a way to unload unuseful
assemblies after loading them?)

Thanks in advance!
 
Leonardo Spina said:
I would need to iterate through all the assemblies I can find on mi pc and
use only those which implement a specific interface I wrote.
The only way I found is to load one by one all the assemblies I find and
iterate through types and interfaces.
It works but memory usage hugely increases!

Is there another way to do this? (at least a way to unload unuseful
assemblies after loading them?)

Well, without writing your own library to read assembly files (or using
a 3rd party one - there's one available, but I can't remember anything
about it) you're stuck with loading the assembly in the normal way.
However, you can load it into a different AppDomain, and unload the
AppDomain when you're finished with it.
 
Leonardo Spina said:
What do you mean by "your own library to read assembly files"?

I mean that the format for assemblies is publicised, and you can read
them without loading them as assemblies into the CLR. It's just a bit
of a pain to do.
 
Back
Top