public object Clone() { var c = new MyCloneableClass { I = I, S = S }; return(c); }
public void TestCloneClass() { var c = new MyCloneableClass { I = 1, S = "hello" }; var oC = StmTransaction.CreateObject(c); using (var tx = StmTransaction.BeginTransaction()) { var c2 = oC.Read(StmReadOption.ReadWrite); Assert.AreNotEqual(c, c2); Assert.AreEqual(c.I, c2.I); Assert.AreEqual(c.S, c2.S); } using (var tx = StmTransaction.BeginTransaction()) { var c2 = oC.Read(); // the default read option is "ReadWrite" Assert.AreNotEqual(c, c2); } }
public void TestCloneClass() { var c = new MyCloneableClass {I = 1, S = "hello"}; var oC = StmTransaction.CreateObject(c); using (var tx = StmTransaction.BeginTransaction()) { var c2 = oC.Read(StmReadOption.ReadWrite); Assert.AreNotEqual(c, c2); Assert.AreEqual(c.I, c2.I); Assert.AreEqual(c.S, c2.S); } using (var tx = StmTransaction.BeginTransaction()) { var c2 = oC.Read(); // the default read option is "ReadWrite" Assert.AreNotEqual(c, c2); } }
public object Clone() { var c = new MyCloneableClass {I = I, S = S}; return c; }