Exemple #1
0
    static void Main()
    {
        var basket = new Basket();
        var root   = new RootObject {
            Container = basket
        };

        basket.AddBanana();

        var clone = Serializer.DeepClone(root);

        Console.WriteLine(clone.Container.Fruits.Count == 1);     // true
        Console.WriteLine(clone.Container.Bananas.Count == 1);    // true
        Console.WriteLine(ReferenceEquals(
                              clone.Container.Bananas[0],
                              clone.Container.Fruits[0])); // true
        Console.WriteLine(ReferenceEquals(
                              clone.Container.Fruits[0].ContainedBy,
                              clone.Container)); // true
    }