public void Run() { n = new PKG.Node(); n.childs.Add(new PKG.Node { parent = n }); n.childs.Add(new PKG.Node { parent = n }); Console.WriteLine(oh.ToString(n)); var data = new xx.Data(); oh.WriteTo(data, n); Console.WriteLine(oh.ToString(data)); oh.ReadFrom(data, ref __n2); Console.WriteLine(oh.ToString(n2)); Console.WriteLine(n.useCount); Console.WriteLine(n2.useCount); n2 = n; Console.WriteLine(n2.useCount); var c = n.childs[0]; Console.WriteLine(c.useCount); n = null; Console.WriteLine(c.useCount); n2 = null; Console.WriteLine(c.useCount); }
static void Main(string[] args) { var env = new Env(); env.Test(); var data = new xx.Data(); var oh = new xx.ObjectHelper(); var dw = new xx.DataWriter(data, oh); var L = new xx.List <int>(); L.Add(1); L.Add(2); dw.Write(L); Console.WriteLine(oh.ToString(data)); Console.ReadLine(); return; }