简体   繁体   中英

When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?

什么时候使用Assembly.LoadFrom或Assembly.LoadFile是合适的?

Main difference is that LoadFrom can be redirected to another assembly at a different path but with same identity if it's already loaded. LoadFile just loads exactly what the caller requested.

So, you should use LoadFrom when you need to prevent loading second assembly with same identity or just loading assembly twice.

Respectively, you should use LoadFile only if you need to load assembly twice or load two assemblies with same identifier.

You can read more in this article LoadFile vs LoadFrom .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM