public Action OneRun()
        {
            var source = new SomeClass
                         {
                             field = 42,
                             Property = new SomeClass2 { Property = new SomeClass3 { field = new int[1240] } }
                         };

            var replicator = new ObjectReplicator(new ConventionalMetadataProvider());
            replicator.Replicate("12");

            return () => replicator.Replicate(source);
        }
        public Action ReplicatorClone()
        {
            SomeClass source = CreateData();

            var replicator = new ObjectReplicator(new ConventionalMetadataProvider());
            replicator.Replicate(new SomeClass());
            replicator.Replicate(new SomeClass2());

            return () => {
                       source = replicator.Replicate(source);
                       Consume(source);
                   };
        }
        public Action ManyRuns()
        {
            var source = new SomeClass
                         {
                             field = 42,
                             Property = new SomeClass2 { Property = new SomeClass3 { field = new int[1240] } }
                         };

            var replicator = new ObjectReplicator(new ConventionalMetadataProvider());

            return () => {
                       for (int i = 0; i < iterationCount; ++i)
                           source = replicator.Replicate(source);
                   };
        }
示例#4
0
文件: Clone.cs 项目: mijay/NClone
 public static T ObjectIgnoringConventions <T>(T source)
 {
     return(unconventionalReplicator.Replicate(source));
 }
示例#5
0
文件: Clone.cs 项目: mijay/NClone
 public static T ObjectGraph <T>(T source)
 {
     return(conventionalReplicator.Replicate(source));
 }