public static void Main(string[] args)
    {
        var ict = new ImmutableCustomType(2);

        ICT1 = ict;

        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);

        if (@true())
        {
            ict  = new ImmutableCustomType(3);
            ICT2 = ict;
        }

        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);

        if (@false())
        {
            ict  = new ImmutableCustomType(4);
            ICT3 = ict;
        }

        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);

        ict = new ImmutableCustomType(5);
        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);
    }
    public static void Main(string[] args)
    {
        var ict     = new ImmutableCustomType(2);
        var ictCopy = ict;

        Console.WriteLine("{0} {1}", ict, ictCopy);

        ict.Naughty(1);

        Console.WriteLine("{0} {1}", ict, ictCopy);
    }
    public static void Main(string[] args)
    {
        var ict = new ImmutableCustomType(2);
        var ictCopy = ict;

        Console.WriteLine("{0} {1}", ict, ictCopy);

        ict.Naughty(1);

        Console.WriteLine("{0} {1}", ict, ictCopy);
    }
    public static void Main (string[] args) {
        var actors = new List<object>();
        int width = 3, height = 3;

        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                var pos = new ImmutableCustomType(x + (y * width));

                actors.Add(CreateActor(pos));
            }
        }

        foreach (var actor in actors)
            Console.Write("{0} ", actor);
        Console.WriteLine();
    }
    public static void Main (string[] args) {
        var ct = new CustomType(1);
        var ict = new ImmutableCustomType(2);

        CT = ct;
        ICT = ict;

        Console.WriteLine("{0} {1} {2} {3}", ct, CT, ict, ICT);

        CT = CT.Add(1);
        ICT = ICT.Add(3);

        Console.WriteLine("{0} {1} {2} {3}", ct, CT, ict, ICT);

        ct = CT;
        ict = ICT;

        Console.WriteLine("{0} {1} {2} {3}", ct, CT, ict, ICT);
    }
    public static void Main (string[] args) {
        var ict = new ImmutableCustomType(2);
        ICT1 = ict;

        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);

        ict = new ImmutableCustomType(3);
        ICT2 = ict;

        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);

        ict = new ImmutableCustomType(4);
        ICT3 = ict;

        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);

        ict = new ImmutableCustomType(5);
        Console.WriteLine("{0} {1} {2} {3}", ICT1, ICT2, ICT3, ict);
    }
Пример #7
0
    public static void Main(string[] args)
    {
        var ct  = new CustomType(1);
        var ict = new ImmutableCustomType(2);

        CT  = ct;
        ICT = ict;

        Console.WriteLine("{0} {1} {2} {3}", ct, CT, ict, ICT);

        CT  = CT.Add(1);
        ICT = ICT.Add(3);

        Console.WriteLine("{0} {1} {2} {3}", ct, CT, ict, ICT);

        ct  = CT;
        ict = ICT;

        Console.WriteLine("{0} {1} {2} {3}", ct, CT, ict, ICT);
    }
    public static void Main(string[] args)
    {
        var actors = new List <object>();
        int width = 3, height = 3;

        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                var pos = new ImmutableCustomType(x + (y * width));

                actors.Add(CreateActor(pos));
            }
        }

        foreach (var actor in actors)
        {
            Console.Write("{0} ", actor);
        }
        Console.WriteLine();
    }
 public static object CreateActor (ImmutableCustomType pos) {
     return pos;
 }
 public void Naughty (int newValue) {
     this = new ImmutableCustomType(newValue);
 }
 public void Naughty(int newValue)
 {
     this = new ImmutableCustomType(newValue);
 }
 public static object CreateActor(ImmutableCustomType pos)
 {
     return(pos);
 }