static void Main(string[] args) { Product product1 = new Product(); product1.Id = 1; product1.ProductName = "Elma"; product1.Fiyat = 12; product1.Aciklama = "Amasya Elması"; Product product2 = new Product(); product2.Id = 2; product2.ProductName = "Karpuz"; product2.Fiyat = 73; product2.Aciklama = "Diyatbakır Karpuzu"; Product[] products = new Product[] { product1, product2 }; foreach (Product product in products) { Console.WriteLine(product.ProductName); } Console.WriteLine("************* Method ****************"); SepetManager sepetmanager = new SepetManager(); sepetmanager.Add(product1); sepetmanager.Add(product2); }
static void Main(string[] args) { Product product1 = new Product(); product1.ProductName = "tavuk dürüm"; product1.Id = 1; product1.explanation = "hatay dürümü"; product1.Price = 10; Product product2 = new Product(); product2.ProductName = "lahmacun"; product2.Id = 2; ; product2.explanation = "çıtır çıtır"; product2.Price = 7; Product[] Pruducts = new Product[] { product1, product2 }; foreach (Product products in Pruducts) { Console.WriteLine(products.ProductName + " " + products.explanation); } Console.WriteLine("----------Methods------------"); //instance-örnek //encapsulation SepetManager sepetmanager = new SepetManager(); sepetmanager.Add(product1); sepetmanager.Add(product2); sepetmanager.Add2(12, 1, "güzel", "elma", 7); }
static void Main(string[] args) { Product urun1 = new Product(); urun1.Adi = "Elma"; urun1.Fiyati = 15; urun1.Aciklama = "Amasya elması"; Product urun2 = new Product(); urun2.Adi = "Karpuz"; urun2.Fiyati = 80; urun2.Aciklama = "Diyarbakır karpuzu"; Product[] urunler = new Product[] { urun1, urun2 }; foreach (Product urun in urunler) { Console.WriteLine(urun.Adi); Console.WriteLine(urun.Fiyati); Console.WriteLine(urun.Aciklama); Console.WriteLine("-----------------------------"); } Console.WriteLine("---------------Metotlar---------------"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(urun1); sepetManager.Add(urun2); sepetManager.Add2("Armut", "Yesil Armut", 12); }
static void Main(string[] args) { //Dont repeat yourself - DRY - Clean Code - Best Practice Product product1 = new Product(); product1.Name = "Apple"; product1.Price = 15; product1.Definition = "Amasya Apple"; Product product2 = new Product(); product2.Name = "Watermelon"; product2.Price = 80; product2.Definition = "Diyarbakir Watermelon"; Product[] products = new Product[] { product1, product2 }; foreach (var allProduct in products) { Console.WriteLine(allProduct.Name + " : " + allProduct.Price + " : " + allProduct.Definition); } Console.WriteLine("-----------METHODS------------"); //instance //cw = console.writeline -- prop = property getter setter yazar SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Lemon", "Mersin Lemon", 15, 50); sepetManager.Remove(product1); }
static void Main(string[] args) { //intance Product product1 = new Product(); product1.Name = "Elma"; product1.Price = 15; product1.Explanation = "Amasya elması"; Product product2 = new Product(); product2.Name = "Karpuz"; product2.Price = 80; product2.Explanation = "Diyarbakır karuzu"; Product[] products = new Product[] { product1, product2 }; foreach (Product product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Explanation); Console.WriteLine("----------------------------"); } Console.WriteLine("-------------Methods-----------"); //instance SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); }
static void Main(string[] args) { Product product1 = new Product(); product1.Name = "Elma"; product1.Price = 20; product1.Note = "Amasya Elması"; Product product2 = new Product(); product2.Name = "Karpuz"; product2.Price = 80; product2.Note = "İzmir Karpuzu"; Product[] products = new Product[] { product1, product2 }; foreach (Product product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Note); Console.WriteLine("-----------------------"); } SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); var x = 5 < 7 ? 6:9; Console.WriteLine(x); }
static void Main(string[] args) { Product product1 = new Product(); product1.Name = "apple"; product1.Purchase = 15; product1.Explanation = "Amasya apple"; Product product2 = new Product(); product2.Name = "watermelon"; product2.Purchase = 80; product2.Explanation = "Diyarbakır watermelon"; Product[] products = new Product[] { product1, product2 }; foreach (var product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Purchase); Console.WriteLine(product.Explanation); Console.WriteLine("--------------------"); } Console.WriteLine("---------Methods---------"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); }
static void Main(string[] args) { Product product1 = new Product(); product1.Name = "Elma"; product1.Price = 10; product1.Description = "Amasya Elması"; Product product2 = new Product(); product2.Name = "Karpuz"; product2.Price = 30; product2.Description = "Diyarbakır Karpuzu"; Product[] products = new Product[] { product1, product2 }; foreach (Product product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Description); Console.WriteLine("-------------------"); } Console.WriteLine("-------------Methods------------"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); }
static void Main(string[] args) { string urunAdi = "Elma"; double fiyati = 15; string aciklama = "Amasya elması"; string[] meyveler = new string[] { "Elma", "Karpuz" }; //class olduğu için productı newleriz. Product product1 = new Product(); product1.Adi = "Elma"; product1.Fiyati = 15; product1.Aciklama = "Amasya elması"; Product product2 = new Product(); product2.Adi = "Karpuz"; product2.Fiyati = 80; product2.Aciklama = "Diyarbakır karpuzu"; Product[] products = new Product[] { product1, product2 }; //type-safe -- tip güvenli ne ile çalışacağını bilmek ister, product burada tip verir // var ürünü direkt product tipi yapar. foreach (Product product in products) // her elemanı tek tek gez ve ekrana yazdır. { // normalde htmlde mesela <li> {}<li> gibi yazılır // cw programcı yazı aracıdır. program içinde kullanılmaz normalde. dil yazanın ne çıkacağını görmesi işine yarar. Console.WriteLine(product.Adi); Console.WriteLine(product.Aciklama); Console.WriteLine(product.Fiyati); Console.WriteLine("-------------------------"); } // genellikle bu productlar bir veri kaynağından gelir. // classla da array oluşturabiliriz. Console.WriteLine("----------Methods------------"); //instance- class örneği ulaştırmak. //encapsulation = kapsülleme demektir. SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Armut", "Yeşil armut", 12); Console.WriteLine("Hello World!"); }
static void Main(string[] args) { string urunAdi1 = "Elma"; double fiyati1 = 15; string aciklama1 = "Amasya Elması"; string[] meyveler = new string[] { }; Product product1 = new Product(); product1.Adi = "Elma"; product1.Fiyati = 15; product1.Aciklama = "Amasya Elması"; Product product2 = new Product(); product2.Adi = "Karpuz"; product2.Fiyati = 80; product2.Aciklama = "Adana Karpuzu"; Product[] products = new Product[] { product1, product2 }; foreach (var product in products) //in products(products dizisinin elamanlarını tek tek gez.(product) takma isim.(Product) çalışılacak veri tipi. { Console.WriteLine(product.Adi); Console.WriteLine(product.Fiyati); Console.WriteLine(product.Aciklama); Console.WriteLine("--------------------"); } Console.WriteLine("----------Methods----------"); //instance - örnek //Encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Armut", "Yeşil armut", 12, 100); sepetManager.Add2("Elma", "Yeşil Elma", 12, 150); sepetManager.Add2("Karpuzt", "Adana Karpuzu", 12, 200); }
static void Main(string[] args) { Product product1 = new Product(); product1.Id = 1; product1.Adi = "Dolap"; product1.Aciklama = "Beyaz"; product1.Fiyati = 1500; Product product2 = new Product(); product2.Id = 2; product2.Adi = "Telefon"; product2.Aciklama = "Samsung"; product2.Fiyati = 5500; Product product3 = new Product(); product3.Id = 3; product3.Adi = "Kazak"; product3.Aciklama = "Yün"; product3.Fiyati = 500; Product[] products = { product1, product2, product3 }; foreach (var product in products) { Console.WriteLine(product.Adi + " " + product.Aciklama + " " + product.Fiyati); } Console.WriteLine("--------------Metotlar-------------"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); }
static void Main(string[] args) { Product product1 = new Product(); product1.ProductName = "Elma"; product1.ProductPrice = 5; product1.ProductDescription = "Amasya elması"; Product product2 = new Product(); product2.ProductName = "Karpuz"; product2.ProductPrice = 20; product2.ProductDescription = "Diyarbakır karpuzu"; Product[] products = new Product[] { product1, product2 }; //type-safe==tip güvenliği foreach (Product product in products) { Console.WriteLine(product.ProductName); Console.WriteLine(product.ProductPrice); Console.WriteLine(product.ProductDescription); Console.WriteLine("------------------------"); } Console.WriteLine("----------Methods---------------"); //ıntance---class örneği oluşturma //encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add2(1, "Kalem"); }
static void Main(string[] args) { int x; Product product1 = new Product(); product1.Id = 1; product1.ProductName = "Elma"; product1.productSale = 15; product1.ProductAccount = "Amasya Elması"; product1.Stock = 100; Product product2 = new Product(); product2.Id = 2; product2.ProductName = "Karpuz"; product2.productSale = 80; product2.ProductAccount = "Diyarbakır Karpuzu"; Product product3 = new Product(); product3.Id = 3; product3.ProductName = "Kavun"; product3.productSale = 56; product3.ProductAccount = "kilis kavunu"; x = 0; Product[] products = new Product[] { product1, product2, product3 }; foreach (Product product in products) { Console.WriteLine("Product name : " + product.ProductName); Console.WriteLine("Product Account : " + product.ProductAccount); Console.WriteLine("Sale :" + product.productSale); Console.WriteLine("Stock : " + product.Stock); if (x == 2) { break; } Console.WriteLine("-----------------"); x++; } Console.WriteLine("-------------------------Methods---------------------"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); }
static void Main(string[] args) { string urunAdi = "Elma"; double fiyati = 15; string aciklama = "Amasya elması"; string[] meyveler = new string[] { }; Urun urun1 = new Urun(); urun1.Adi = "Elma"; urun1.Fiyati = 15; urun1.Aciklama = "Amasya elması"; Urun urun2 = new Urun(); urun2.Adi = "Karpuz"; urun2.Fiyati = 80; urun2.Aciklama = "Diyarbakır karpuzu"; Urun[] urunler = new Urun[] { urun1, urun2 }; //type safe -- tip güvenli foreach (Urun urun in urunler) { Console.WriteLine(urun.Adi); Console.WriteLine(urun.Fiyati); Console.WriteLine(urun.Aciklama); Console.WriteLine("------------------"); } Console.WriteLine("-----------Metotlar---------"); //instance - örnek //encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(urun1); sepetManager.Add(urun2); sepetManager.Ekle2("Armut", "Yeşil armut", 12, 5); sepetManager.Ekle2("Elma", "Yeşil elma", 12, 10); sepetManager.Ekle2("Karpuz", "Diyarbakır karpuzu", 12, 8); }
static void Main(string[] args) { string productName = "Apple"; double unitPrice = 15; string description = "Amasya apple"; string[] fruits = new string[] { "Apple", "Watermelon" }; Product product1 = new Product(); product1.ProductName = "Apple"; product1.UnitPrice = 15; product1.Description = "Amasya apple"; Product product2 = new Product(); product2.ProductName = "Watermelon"; product2.UnitPrice = 80; product2.Description = "Diyarbakır watermelon"; Product[] products = new Product[] { product1, product2 }; //type-safe -- tip güvenli foreach (var product in products) //2 kere dönücek 2 ürün var. urunler dizi, urun her bir elemanı tanımlamak için değişken { Console.WriteLine(product.ProductName); Console.WriteLine(product.UnitPrice); Console.WriteLine(product.Description); Console.WriteLine("--------------------"); } Console.WriteLine("------------Methods---------------"); //instance - örnek //encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Pear", "Green pear", 12, 10); //encapsulation- ayrı ayrı yazılanların bir düzene girmesi sepetManager.Add2("Apple", "Green apple", 12, 9); sepetManager.Add2("Watermelon", "Diyarbakır watermelon", 12, 8); }
static void Main(string[] args) { Product product1 = new Product(); product1.Name = "Laptop"; product1.Price = 3999; product1.Explanation = "HP 15-RB013NT"; Product product2 = new Product(); product2.Name = "Mouse"; product2.Price = 39; product2.Explanation = "HP Gaming Mouse"; Product[] products = new Product[] { product1, product2 }; //Type-Safe -- Tip Güvenliği foreach (Product product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Explanation); Console.WriteLine("-----------------------------"); } Console.WriteLine("----------METODLAR------------"); //Instance - Örnek //Encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); Console.WriteLine("-----------------------------"); sepetManager.Ekle2("Headphone", "Red Headphone", 25); sepetManager.Ekle2("Keyboard", "Blue Headphone", 75); sepetManager.Ekle2("Phone", "Black Phone", 25); }
static void Main(string[] args) { string productName = "Elma"; double price = 15; string description = "Amasya Elması"; string[] meyveler = new string[] { }; Product urun1 = new Product(); urun1.Name = "Elma"; urun1.Price = 15; urun1.Description = "Amasya Elması"; Product urun2 = new Product(); urun2.Name = "Karpuz"; urun2.Price = 80; urun2.Description = "Diyarbakır karpuzu"; Product[] urunler = new Product[] { urun1, urun2 }; foreach (Product urun in urunler) { Console.WriteLine(urun.Name); Console.WriteLine(urun.Price); Console.WriteLine(urun.Description); Console.WriteLine(" "); } Console.WriteLine("--Metotlar---"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(urun1); sepetManager.Add(urun2); sepetManager.Add2("Armut", 12, "Yeşil Armut"); }
static void Main(string[] args) { //Class olduğu için newlemek lazım Product product1 = new Product(); product1.ProductName = "Apple"; product1.Price = 15; product1.Description = "Apple of Amasya"; Product product2 = new Product(); product2.ProductName = "Watermelon"; product2.Price = 80; product2.Description = "Diyarbakır Karpuzu"; Product[] products = new Product[] { product1, product2 }; //Type safe -- tip güvenli foreach (Product product in products) { Console.WriteLine(product.ProductName); Console.WriteLine(product.Price); Console.WriteLine(product.Description); Console.WriteLine("****************************"); } Console.WriteLine("********************Metotlar****************"); //instance - örnek //encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Armut", "Yeşil armut", 12, 5); }
static void Main(string[] args) { Product product01 = new Product(); product01.Name = "Elma"; product01.Price = 15; product01.Explanation = "Amasya elması"; Product product02 = new Product(); product02.Name = "Karpuz"; product02.Price = 80; product02.Explanation = "Diyarbakır karpuzu"; Product[] products = new Product[] { product01, product02 }; foreach (Product product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Explanation); Console.WriteLine("------------------\n"); } Console.WriteLine("/*/*/*/*/*/ METHODS /*/*/*/*/*/\n"); // instance - örnek // encapsulation - kapsülleme SepetManager sepetManager = new SepetManager(); sepetManager.Add(product01); sepetManager.Add(product02); /* sepetManager Add2'ye parametre eklendiğinde burası patlar, * bu yüzden ürünleri class içinde tanımlamak daha doğrudur!!! */ sepetManager.Add2("Armut", "Yeşil armut", 12, 10); sepetManager.Add2("Elma", "Yeşil elma", 12, 9); sepetManager.Add2("Karpuz", "Diy.Karpuzu", 12, 8); }
static void Main(string[] args) { Product prod1 = new Product(); prod1.Name = "Elma"; prod1.Price = 15; prod1.Description = "Amasya Elması"; Product prod2 = new Product(); prod2.Name = "Karpuz"; prod2.Price = 80; prod2.Description = "Diyarbakır Karpuzu"; Product[] products = new Product[] { prod1, prod2 }; foreach (Product product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Description); Console.WriteLine("-------------"); } Console.WriteLine("--------------Methods---------------"); //instance //encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(prod1); sepetManager.Add(prod2); sepetManager.Add2("Armut", "Yeşil Armut", 12, 58); sepetManager.Add2("Elma", "Yeşil Elma", 12, 85); sepetManager.Add2("Karpuz", "Diyarbakır Karpuzu", 20, 15); }
static void Main(string[] args) { Product prt1 = new Product(); prt1.ID = 12; prt1.Name = "Phone"; prt1.Discription = "Smart"; Product prt2 = new Product(17, "PC", "Gaming"); Product prt3 = new Product { ID = 33, Name = "Mouse", Discription = "RGB" }; Product[] Allproduct = new Product[] { prt1, prt2, prt3 }; SepetManager SptMng = new SepetManager(); SptMng.Add(prt1); SptMng.Add(prt2); SptMng.Add(prt3); }
static void Main(string[] args) { string productName = "Apple"; double price = 12; string explanation = "Red Apple"; Product product1 = new Product(); product1.Name = "Apple"; product1.Price = 15; product1.Explanation = "Red Apple"; Product product2 = new Product(); product2.Name = "Watermelon"; product2.Price = 18; product2.Explanation = "Diyarbakır Watermelon"; Product[] products = new Product[] { product1, product2 }; foreach (Product product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Explanation); Console.WriteLine("************************"); } Console.WriteLine("************Methods*************"); //instance - örnek SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Apple", "Green Apple", 12, 10); sepetManager.Add2("Apple-2", "Red Apple-2", 15, 20); }
static void Main(string[] args) { Product product1 = new Product(); product1.Name = "Elma"; product1.Price = 15; product1.Explanation = "Amasya Elması"; Product product2 = new Product(); product2.Name = "Karpuz"; product2.Price = 80; product2.Explanation = "Diyarbakır Karpuzu"; Product[] products = new Product[] { product1, product2 }; //type-safe -- tip güvenliği foreach (Product product in products) { Console.WriteLine("Ürün Adı: " + product.Name); Console.WriteLine("Fiyatı: " + product.Price); Console.WriteLine(product.Explanation); Console.WriteLine("*********************"); } Console.WriteLine("---------------Methods-----------------"); //instance -- Class örneği oluşturmak //encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); //Aşağıdaki yanlış kullanım örneği sepetManager.Add2("Armut", "Yeşil Armut", 12, 10); sepetManager.Add2("Elma", "Yeşil Elma", 12, 9); sepetManager.Add2("Karpuz", "Diyarbakır Karpuzu", 12, 8); }
static void Main(string[] args) { Product product1 = new Product(); product1.Name = "Elma"; product1.Price = 15; product1.Detail = "Amasya Elması"; Product product2 = new Product(); product2.Name = "Karpuz"; product2.Price = 80; product2.Detail = "Diyarbakır Karpuzu"; Product[] products = new Product[] { product1, product2 }; // type-safe -- tip güvenli foreach (Product product in products) { Console.WriteLine("Ürünün İsmi : " + product.Name); Console.WriteLine("Ürünün Fiyatı : " + product.Price); Console.WriteLine("Ürün Açıklaması : " + product.Detail); Console.WriteLine("---------------"); } Console.WriteLine("------------Methods------------"); //instance - örnek SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); Console.WriteLine("--------------2-------------"); sepetManager.Add2("Armut", "Yeşil Armut", 13, 9); sepetManager.Add2("Elma", "Yeşil Elma", 14, 12); sepetManager.Add2("Karpuz", "Diyarbakır Karpuzu", 50, 7); }
static void Main(string[] args) { //string urunAdi = "Elma"; //double fiyat = 10; DUZENSIZ BIR GOSTERIM DIZI KULLANMAK DAHA MANTIKLI //string aciklama = "Amasya Elmasi"; string[] meyveler = new string[] { "Elma", "Muz" }; Product product1 = new Product(); product1.Adi = "Elma"; product1.Fiyati = 15; product1.Aciklama = "Amasya Elmasi"; Product product2 = new Product(); product2.Adi = "Muz"; product2.Fiyati = 30; product2.Aciklama = "Yerli muz"; Product[] products = new Product[] { product1, product2 }; foreach (Product product in products) { Console.WriteLine(product.Adi); Console.WriteLine(product.Fiyati); Console.WriteLine(product.Aciklama); Console.WriteLine("---------------------------"); } Console.WriteLine("------------METHODS--------------"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Armut", "Yesil armut", 12, 10); sepetManager.Add2("Elma", "Yesil elma", 10, 9); sepetManager.Add2("Karpuz", "Cekirdeksiz Karpuz", 80, 8); }
static void Main(string[] args) { Product product1 = new Product(); product1.Adi = "Elma"; product1.Fiyati = 15; product1.Aciklama = "Amasya Elması"; Product product2 = new Product(); product2.Adi = "Karpuz"; product2.Fiyati = 80; product2.Aciklama = "Diyarbakır Karpuzu"; Product[] products = new Product[] { product1, product2 }; //type-safe foreach (Product product in products) { Console.WriteLine(product.Adi); Console.WriteLine(product.Fiyati); Console.WriteLine(product.Aciklama); Console.WriteLine("---------------------------"); } Console.WriteLine("-----------------------Methods---------------------"); //instance //encapsulation SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Armut", "Yeşil Armut", 12, 10); sepetManager.Add2("Elma", "Yeşil Elma", 12, 9); sepetManager.Add2("Karpuz", "D.Bakır Karpuzu", 12, 8); }
static void Main(string[] args) { Products product1 = new Products(); product1.Name = "elma"; product1.Price = 15; product1.Description = "Amasya Elması"; product1.Stock = 1200; Products product2 = new Products(); product2.Name = "Karpuz"; product2.Price = 80; product2.Description = "Diyarbakır Karpuzu"; product2.Stock = 100 Products[] products = new Products[] { product1, product2 }; //type-safe -- tip güvenli foreach (Products product in products) { Console.WriteLine(product.Name); Console.WriteLine(product.Price); Console.WriteLine(product.Description); } Console.WriteLine("---------Methods---------"); //instance -- örnek SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Armut", "Yeşil Armut", 12); }
static void Main(string[] args) { Product prod1 = new Product(); prod1.Name = "Apple"; prod1.Price = 15; prod1.Description = "Big Apple"; Product prod2 = new Product(); prod2.Name = "Watermelon"; prod2.Price = 80; prod2.Description = "Red Watermelon"; Product[] products = new Product[] { prod1, prod2 }; foreach (Product prod in products) { Console.WriteLine(prod.Name); Console.WriteLine(prod.Price); Console.WriteLine(prod.Description); Console.WriteLine("----------------"); } Console.WriteLine("----------Methods-----------"); SepetManager sepetManager = new SepetManager(); sepetManager.Add(prod1); sepetManager.Add(prod2); //Useless Example. /* * sepetManager.Add2("Birne", "Yellow Birne", 12); * sepetManager.Add2("Apple", "Green Apple, 12); * sepetManager.Add2("Melon", "Red Melon", 12); */ }
static void Main(string[] args) { Product product1 = new Product(); product1.Id = 1; product1.Name = "Telefon"; product1.Price = 5000; Product product2 = new Product(); product2.Id = 2; product2.Name = "Bilgisayar"; product2.Price = 10000; Product[] product = new Product[] { product1, product2 }; foreach (var products in product) { Console.WriteLine(products.Id); Console.WriteLine(products.Name); Console.WriteLine(products.Price); Console.WriteLine("----------------"); } Console.WriteLine("----------------Methods----------------"); //Instance - Örnek //Encapsulation - Bir şeyi düzenli bir şekilde yazma/kapsülleme olayı SepetManager sepetManager = new SepetManager(); sepetManager.Add(product1); sepetManager.Add(product2); sepetManager.Add2("Bisiklet", "Mavi bisiklet", 500); sepetManager.Add2("Tost Makinası", "tost makinası", 300); Console.ReadLine(); }
static void Main(string[] args) { Product product1 = new Product(); product1.Id = 1; product1.Name = "Elma"; product1.Price = 1.50; product1.Stock = 50; Product product2 = new Product(); product2.Id = 2; product2.Name = "Çilek"; product2.Price = 8.25; product2.Stock = 25; Product product3 = new Product(); product3.Id = 3; product3.Name = "Muz"; product3.Price = 10; product3.Stock = 15; Product[] products = new Product[] { product1, product2, product3, }; foreach (var alias in products) { Console.WriteLine("\nProduct Id = {0}\nProduct Name = {1}\nProduct Price = {2}\nProduct Stock = {3}", alias.Id, alias.Name, alias.Price, alias.Stock); } SepetManager sepetmanager = new SepetManager(); sepetmanager.Add(product1); sepetmanager.Add(product2); }