Exemple #1
0
        static void Main(string[] args)
        {
            Customer customer = new Customer {
                FirstName = "Engin",
                LastName  = "Demiroğ",
                City      = "Ankara",
                Id        = 1
            };



            var customer2 = (Customer)customer.Clone();

            customer2.FirstName = "Salih";
            Console.WriteLine(customer.FirstName);
            Console.WriteLine(customer2.FirstName);

            /*
             * customer1 i customer2 ye eşitledikten sonra
             * firstnamede yaptığımız değişiklik eğer prototype design pattern
             * yani clonelayıp referansını değiştirmeseydik aynı olacaktı
             * ancak cloneladığımız için yeni bir referans oluturdu.
             * Hem newlemenin maliyetinden kurtulduk hemde yeni bir customer
             * nesnesi oluşturduk.
             */
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                Id = 1, FirstName = "Sergen", LastName = "Keleş", City = "İstanbul"
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Simge";
            Console.WriteLine("customer1'deki veri " + customer1.FirstName + " " + customer1.LastName);
            Console.WriteLine("customer2'deki veri " + customer2.FirstName + " " + customer2.LastName);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                Id = 1, FirstName = "Uğur", LastName = "Karayel", City = "Kocaeli"
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Burcu";

            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Customer customer = new Customer {
                FirtsName = "Engin", LastName = "Demiroğ", City = "Ankara", Id = 1
            };


            Customer customer2 = (Customer)customer.Clone();

            customer2.FirtsName = "Salih";
            Console.WriteLine(customer.FirtsName);
            Console.WriteLine(customer2.FirtsName);
        }
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "utku", LastName = "mutlu", City = "İstanbul", Id = 1
            };


            var customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Arzu";
            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);
        }
        static void Main()
        {
            Customer customer = new Customer()
            {
                FirstName = "Emre", LastName = "Karahan", City = "İstanbul", Id = 1
            };
            var customer2 = (Customer)customer.Clone();


            customer2.FirstName = "Salih";
            Console.WriteLine(customer.FirstName);
            Console.WriteLine(customer2.LastName);
        }
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                Id = 1, FirstName = "Muhsin", LastName = "Yolcu", City = "İstanbul"
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Albert";

            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);
        }
Exemple #8
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Mert", LastName = "Aksoy", City = "İstanbul", Id = 1
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Can";
            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
Exemple #9
0
        public static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Mehmet", LastName = "Teker", City = "Van", id = 1
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Fadime";

            Console.WriteLine("Customer1 : " + customer1.FirstName);
            Console.WriteLine("Customer2 : " + customer2.FirstName);
            Console.WriteLine("Customer2 : " + customer2.City);
            Console.ReadLine();
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Customer customer = new Customer {
                FirstName = "Joe", LastName = "Doe", City = "Space"
            };

            Customer customer2 = (Customer)customer.Clone();

            customer2.FirstName = "Merlin";

            Console.WriteLine(customer.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
Exemple #11
0
        static void Main(string[] args)
        {
            var customer = new Customer {
                FirstName = "Fethi", LastName = "Meşe", City = "Istanbul", Id = 1
            };

            var customer2 = (Customer)customer.Clone();

            customer2.FirstName = "Mehmet";

            Console.WriteLine(customer.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.Read();
        }
Exemple #12
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Sefa", LastName = "Pınar", City = "Sivas", Id = 1
            };


            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "İrem";
            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                Id = 1, FirstName = "Caglar", LastName = "Durmus", City = "istanbul"
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Ali";
            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);
            Console.WriteLine(customer2.LastName);

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Ali Kaan", LastName = "Türkmen", City = "İzmir", Id = 1
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "İsmail";

            Console.WriteLine(customer1.FirstName + " " + customer1.LastName + " " + customer1.City);
            Console.WriteLine(customer2.FirstName + " " + customer2.LastName + " " + customer2.City);

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            //newleme maliyetlerini kısmak için kullanılır.
            //önemli olan kısım nesne yeniden oluşur, referans tip olmasına rağmen Customer nesnesi bir kere türetilir sonrasında içinden istenildiği kadar customer  türetilebilir.

            Customer firstCust = new Customer {
                Id = 1, FirstName = "Fehmi", LastName = "Aksakal", City = "İstanbul"
            };

            Customer secondCustomer = (Customer)firstCust.Clone();

            secondCustomer.FirstName = "SecFehmi";

            Console.WriteLine("First Name for FirstCustomer:" + firstCust.FirstName + "\nFirst Name for SecondCustomer:" + secondCustomer.FirstName + "");
        }
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Yusuf", LastName = "Sertbolat", City = "Bursa", Id = 1
            };                                                //ilk müşterimizi oluşturup yazdık

            Customer customer2 = (Customer)customer1.Clone(); //elimizdeki nesneyi kullanarak bir klon oluşturduk ve onun da istediğimiz bilgilerini yazdık

            customer2.FirstName = "Recep";

            Console.WriteLine(customer1.FirstName); //artık iki nesneyi de kullanabiliriz ve klonlanmış oolan nesne ile klonladığımız nesne artık birbirinden farklı nesneler
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
Exemple #17
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                City = "Ankara", FirstName = "Yasin", LastName = "Anything", Id = 1
            };

            Console.WriteLine("customer 1 firstname: " + customer1.FirstName);

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Emre";
            Console.WriteLine("customer 1 firstname (after clone): " + customer1.FirstName);
            Console.WriteLine("customer 2 firstname: " + customer2.FirstName);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Ahmet", LastName = "Yılmaz", City = "Eskişehir", Id = 1
            };

            var customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Burak";

            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
Exemple #19
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                City = "İstanbul", FirstName = "Ezgi", LastName = "Akar", Id = 1
            };


            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Berat";

            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
Exemple #20
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Hamit", LastName = "Doğan", City = "Istanbul", Id = 1
            };

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Salih";

            //customer1 ve customer2 aynı referansı tutmuyorlar. Yeni referans oluşturma maliyetinden kurtardık.
            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
Exemple #21
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Engin", LastName = "Demiroğ", City = "Ankara", Id = 1
            };

            // kopyasını alma
            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Salih";

            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.LastName);

            Console.ReadLine();
        }
Exemple #22
0
        static void Main(string[] args)
        {
            Customer customer = new Customer {
                Id = 1, FirstName = "Arif", LastName = "Tarpıcı", City = "İstanbul"
            };

            Customer newCustomer = (Customer)customer.Clone();

            newCustomer.FirstName = "arif";

            /* customer and newCustomer are separate references */
            Console.WriteLine(customer.FirstName);
            Console.WriteLine(newCustomer.FirstName);

            Console.ReadLine();
        }
Exemple #23
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "Umut", LastName = "Sepetci", city = "İstanbul", Id = 1
            };

            Console.WriteLine(customer1.FirstName);

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Arif";
            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Customer customer = new Customer()
            {
                Id        = 1,
                FirstName = "Can",
                LastName  = "Berat",
                City      = "İstanbul"
            };
            Customer customer2 = (Customer)customer.Clone();

            customer2.FirstName = "Leyla";

            Console.WriteLine(customer.FirstName);
            Console.WriteLine(customer2.FirstName);
            Console.ReadKey();
        }
Exemple #25
0
        static void Main(string[] args)
        {
            //Clone üzerinden gider ve performans anlamında iyidir
            Customer customer1 = new Customer {
                FirstName = "Emircan", LastName = "Dalman", City = "Giresun", Id = 1
            };

            Console.WriteLine(customer1.FirstName);

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Ali";
            customer2.LastName  = "Dalman";
            customer2.City      = "Giresun";
            customer2.Id        = 2;
            Console.WriteLine(customer2.FirstName);
        }
Exemple #26
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "İlker", LastName = "Epik", City = "Adana", Id = 1
            };

            Console.WriteLine("Müsteri 1 Adı: {0}", customer1.FirstName);

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Salih";

            Console.WriteLine("Müşteri 2 Adı: {0}", customer2.FirstName);
            Console.WriteLine("Müsteri 1 Adı: {0}", customer1.FirstName);

            Console.ReadLine();
        }
Exemple #27
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                Id = 1, FirstName = "serdar", LastName = "yurtsever", City = "istanbul"
            };

            Console.WriteLine(customer1.FirstName);

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "ali";

            Console.WriteLine(customer1.FirstName);
            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }
Exemple #28
0
        static void Main(string[] args)
        {
            Customer customer = new Customer()
            {
                Name = "faruk", LastName = "kardaş", Budget = 350, Id = 1
            };


            Customer customer2 = (Customer)customer.Clone();

            customer2.Name     = "Fatih";
            customer2.LastName = "Kardaşş";
            customer2.Budget   = 500;
            customer2.Id       = 2;

            Console.WriteLine(customer.Name);
            Console.WriteLine(customer2.Name);
        }
Exemple #29
0
        static void Main(string[] args)
        {
            Customer customer = new Customer
            {
                FirstName = "Murat",
                LastName  = "Altınpınar",
                City      = "Ankara",
                Id        = 1
            };

            var customer2 = (Customer)customer.Clone();

            customer2.FirstName = "Gurur";

            Console.WriteLine(customer.FirstName);
            Console.WriteLine(customer2.FirstName);
            Console.ReadLine();
        }
Exemple #30
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer {
                FirstName = "cemil", LastName = "biri", City = "nott", Id = 1
            };

            Console.WriteLine(customer1.FirstName);

            Customer customer2 = (Customer)customer1.Clone();

            customer2.FirstName = "Salih";

            Console.WriteLine(customer1.FirstName);

            Console.WriteLine(customer2.FirstName);

            Console.ReadLine();
        }