/// <summary> /// 构造函数,需要给当前域传key,兼容standard2.0 /// </summary> /// <param name="key"></param> public DomainBase(string key) #if NETCOREAPP3_0_OR_GREATER : base(isCollectible: true, name: key) #endif { #if !NETCOREAPP3_0_OR_GREATER Name = key; #endif AssemblyReferencesCache = new ConcurrentDictionary <Assembly, PortableExecutableReference>(); OtherReferencesFromFile = new ConcurrentDictionary <string, PortableExecutableReference>(); if (key == "Default") { DefaultDomain = this; Default.Resolving += Default_Resolving; #if NETCOREAPP3_0_OR_GREATER Default.ResolvingUnmanagedDll += Default_ResolvingUnmanagedDll; #endif } }
/// <summary> /// 构造函数,需要给当前域传key,兼容standard2.0 /// </summary> /// <param name="key"></param> public DomainBase(string key) #if !NETSTANDARD2_0 : base(isCollectible: true, name: key) #endif { #if NETSTANDARD2_0 Name = key; #endif DllAssemblies = new ConcurrentDictionary <string, Assembly>(); ReferencesFromStream = new ConcurrentDictionary <Assembly, PortableExecutableReference>(); ReferencesFromFile = new ConcurrentDictionary <string, PortableExecutableReference>(); if (key == "Default") { DefaultDomain = this; Default.Resolving += Default_Resolving; #if !NETSTANDARD2_0 Default.ResolvingUnmanagedDll += Default_ResolvingUnmanagedDll; #endif } }