예제 #1
0
        static void Main(string[] args)
        {
            // ken is the prototype, except a few things, the properties won't change much in clones.
            // https://en.wikipedia.org/wiki/Prototype_pattern
            var ken = new Prototype
            {
                Name = "Ken",
                Age = 27
            };

            var barry = (Prototype) ken.Clone();
            barry.Name = "Barry";
        }
예제 #2
0
 static void Report(string s, Prototype a, Prototype b)
 {
     Console.WriteLine("\n{0}\nPrototype  {1}\nClone      {2}", s, a, b);
 }
예제 #3
0
 static string GetDetails(Prototype p)
 {
     return($"ID: {p.ID}  hashcode: {p.GetHashCode()}");
 }