コード例 #1
0
        private static ICloner <T> GetDeconstructCloner(Type type)
        {
            var pair = TypeHelper.GetConstructorDeconstructPair(type);

            if (pair == null)
            {
                return(null);
            }
            return(DeconstructCloner.GetInstance(pair.Item1, pair.Item2));
        }
コード例 #2
0
ファイル: CloneHelper.cs プロジェクト: rjmcguire/Theraot
            public static ICloner <T> GetInstance(MethodInfo deconstruct, ConstructorInfo constructor)
            {
                var found = _instance;

                if (found == null)
                {
                    var created = new DeconstructCloner(deconstruct, constructor);
                    found = Interlocked.CompareExchange(ref _instance, created, null);
                    if (found == null)
                    {
                        return(created);
                    }
                }
                return(found);
            }