private static ICloner <T> GetConstructorCloner(Type type) { var constructorInfo = type.GetConstructor(new[] { type }); if (constructorInfo == null) { return(null); } return(ConstructorCloner.GetInstance(constructorInfo)); }
public static ICloner <T> GetInstance(ConstructorInfo constructor) { var found = _instance; if (found == null) { var created = new ConstructorCloner(constructor); found = Interlocked.CompareExchange(ref _instance, created, null); if (found == null) { return(created); } } return(found); }