Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

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

like image 222
rohit Avatar asked Apr 20 '11 10:04

rohit


1 Answers

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.

like image 170
Andrey Tretyak Avatar answered Oct 23 '22 10:10

Andrey Tretyak