private void GetByDomin() { // Dictionary<string, Assembly> loaded = new Dictionary<string, Assembly>(); AppDomain domain = AppDomain.CurrentDomain; Assembly[] assemblies = domain.GetAssemblies(); foreach (Assembly ass in assemblies) { string name = ass.FullName; if (!AssamblyList.ContainsKey(name)) { AssamblyList.Add(name, ass); } } }
public void GetByCodePath() { string[] files = Directory.GetFiles(CodePath, "*.dll", SearchOption.TopDirectoryOnly); foreach (string file in files) { AssemblyName assemblyName; assemblyName = AssemblyName.GetAssemblyName(file); Assembly assembly; string name = assemblyName.FullName; if (AssamblyList.ContainsKey(name)) { assembly = AssamblyList[name]; } else { assembly = Assembly.Load(assemblyName); AssamblyList.Add(name, assembly); } } }