| 1234567891011121314151617181920212223242526272829303132333435 | using System;using System.Collections.Concurrent;using System.Collections.Generic;using System.Linq;using System.Reflection;namespace OpenSEMI.Core.Container{	internal class ConstructorCache	{		private static ConcurrentDictionary<Type, ConstructorInfo> _constructorCache = new ConcurrentDictionary<Type, ConstructorInfo>();		public static ConstructorInfo GetConstructor(Type type)		{			if (!_constructorCache.TryGetValue(type, out ConstructorInfo value))			{				ConstructorInfo constructorInfo2 = _constructorCache[type] = DiscoverConstructor(type.GetTypeInfo());				value = constructorInfo2;				return value;			}			return value;		}		private static ConstructorInfo DiscoverConstructor(TypeInfo typeInfo)		{			IEnumerable<ConstructorInfo> declaredConstructors = typeInfo.DeclaredConstructors;			if (declaredConstructors.Any())			{				return declaredConstructors.First();			}			return null;		}	}}
 |