コード例 #1
0
        public void CloneTest()
        {
            var p = new Person()
            {
                name = "Rudy", adres = "Profeinthovenstraat"
            };
            var q = p;
            var r = (Person)p.DeepClone();

            p.name = "Piet";
            Assert.IsTrue(p.name == "Piet", "Always");
            Assert.IsTrue(q.name == "Piet", "Always");
            Assert.IsTrue(r.name == "Rudy", "No deep clone");
        }