CSharp examples for System.Reflection:Assembly
Load All Dependencies
using System.Reflection; using System;//from w ww . j av a 2 s .com public class Main{ public static void LoadAllDependencies(this Assembly assembly) { assembly.LoadAllDependencies(x => true); } public static void LoadAllDependencies(this Assembly assembly, Func<AssemblyName, bool> dependentAssemblyMatcher) { foreach (AssemblyName assemblyName in assembly.GetReferencedAssemblies()) { if (dependentAssemblyMatcher(assemblyName)) { Assembly referencedAssembly = Assembly.Load(assemblyName); referencedAssembly.LoadAllDependencies(dependentAssemblyMatcher); } } } }