Ejemplo n.º 1
0
        static void demoClone()
        {
            CloneDemo demo = new CloneDemo(2);

            Console.WriteLine("Object: " + demo.GetHashCode() + " value: " + demo.Value);
            CloneDemo clone = demo.Clone() as CloneDemo;

            Console.WriteLine("Object: " + clone.GetHashCode() + " value: " + clone.Value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Return a copy of the object of this class.
        /// According to MS Docs, it can be shallow copy, deep copy and something in between
        /// </summary>
        public Object Clone()
        {
            var temp = new CloneDemo(_value);

            return(temp);
        }