All pastes #465671 Raw Edit

Stuff

public text v1 · immutable
#465671 ·published 2007-04-30 14:20 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Test[] test = new Test[2];
            Test[] cloneTest = new Test[3];

            test[0] = new Test();
            test[0].blah2 = 20;

            cloneTest[0] = new Test();
            cloneTest[0].MakeClone(test[0]);

            Console.WriteLine(test[0].blah2);
            Console.WriteLine(cloneTest[0].blah2);

            test[0].blah2 = 30;

            Console.WriteLine(test[0].blah2);
            Console.WriteLine(cloneTest[0].blah2);
        }
    }

    class Test
    {
        int blah = 0;
        public int blah2 = 10;
        
        public void MakeClone (Test a)
        {
            this.blah = a.blah;
            this.blah2 = a.blah2;
        }
    }
}