コード例 #1
0
ファイル: Program.cs プロジェクト: muraatyildiz/First
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.id          = 0;
            product1.ProductName = "Elma";
            product1.Price       = 15;
            product1.explanation = "Amasya elması";

            Product product2 = new Product();

            product2.id          = 1;
            product2.ProductName = "Karpuz";
            product2.Price       = 152;
            product2.explanation = "Diyarbakır";

            Product[] products = new Product[] { product1, product2 };
            foreach (var product in products)
            {
                Console.WriteLine(product.id);
                Console.WriteLine(product.ProductName);
                Console.WriteLine(product.Price);
                Console.WriteLine(product.explanation);
                Console.WriteLine("---------");
            }
            Console.WriteLine("-----------------methods------------------");

            SepetManager sepetManager = new SepetManager();

            sepetManager.Add(product1);
            sepetManager.Add(product2);
            sepetManager.Add2("armut");
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Product product = new Product();

            product.Adi      = "Elma";
            product.Fiyati   = 15;
            product.Aciklama = "Amasya Elmasi";

            Product product1 = new Product();

            product1.Adi       = "Karpuz";
            product1.Fiyati    = 80;
            product1.Aciklama  = "Diyarbekir karpuzu";
            product1.stokAdedi = 5;

            Product[] productArray = new Product[]
            {
                product,
                product1
            };

            foreach (var i in productArray)
            {
                Console.WriteLine(i.Adi + " " + i.Fiyati + " " + i.Aciklama + " " + i.stokAdedi);
                Console.WriteLine("-----------------");
            }

            Console.WriteLine("--------------Methodlar------------- ");
            SepetManager sepet = new SepetManager();

            sepet.Add(product);
            sepet.Add(product1);


            //Add(1, 2, 3, 4, 5);
        }