コード例 #1
0
        private bool TryGetAlreadyLoadingAssembly(
            AssemblyName assemblyName,
            IAssemblyComparer comparer,
            out Task <Assembly?>?assemblyLoadingTask)
        {
            var assemblyLoadingEntry = _loadingAssemblies
                                       .FirstOrDefault(kv => comparer.Equals(assemblyName, kv.Key));

            if (assemblyLoadingEntry.Key == null)
            {
                assemblyLoadingTask = null;
                return(false);
            }

            assemblyLoadingTask = assemblyLoadingEntry.Value;
            return(true);
        }
コード例 #2
0
        private bool TryGetAlreadyLoadedAssembly(
            AssemblyName assemblyName,
            IAssemblyComparer comparer,
            out Assembly?assembly)
        {
            if (_assemblyLoadContext == null)
            {
                assembly = null;
                return(false);
            }

            Assembly?loadedAssembly = _assemblyLoadContext.AllAssemblies
                                      .FirstOrDefault(a => comparer.Equals(assemblyName, a.GetName()));

            assembly = loadedAssembly;
            return(loadedAssembly != null);
        }