using System; using System.Collections.Concurrent; using System.Reflection; namespace BITKit { public class BITSharp { private static readonly ConcurrentDictionary Dictionary = new(); static Assembly[] assemblies; public static bool TryGetTypeFromFullName(string fullClassName,out Type type) { type = GetTypeFromFullName(fullClassName); return type is not null ? true : false; } public static Type GetTypeFromFullName(string fullClassName) { return Dictionary.GetOrAdd(fullClassName, SearchType); } static Type SearchType(string fullName) { assemblies = assemblies??AppDomain.CurrentDomain.GetAssemblies(); foreach (var assembly in assemblies) { var type = assembly.GetType(fullName,false); if (type is not null) { return type; } else { continue; } } return null; } } }