static void Main(string[] args) { Product product1 = new Product(); product1.Id = 1; product1.Name = "Mouse"; product1.Price = 15; product1.About = "ASUS Tuf gaming"; Product product2 = new Product(); product2.Name = "Laptop"; product2.Price = 57; product2.About = "ASUS ROG"; Product[] products = new Product[] { product1, product2 }; foreach (Product product in products) { Console.WriteLine(product.Price); Console.WriteLine(product.Name); Console.WriteLine(product.About); } Console.WriteLine("-----------------------"); Console.WriteLine(); BoxManager boxManager = new BoxManager(); boxManager.Add(product1); boxManager.Add(product2); boxManager.Add2("Elma", "Amasya", 8, 10); boxManager.Add2("Armut", "Amasya", 9, 5); }
public static void Main(string[] args) { Product product1 = new Product(); product1.productName = "Apple"; product1.productPrice = 15; product1.explanation = "From Amasya"; Product product2 = new Product(); product2.productName = "Watermelon"; product2.productPrice = 40; product2.explanation = "From Diyarbakir"; Product[] products = new Product[] { product1, product2 }; //type-safe foreach (Product product in products) { Console.WriteLine(product.productName); Console.WriteLine(product.productPrice); Console.WriteLine(product.explanation); Console.WriteLine("-----------------"); } Console.WriteLine("------------Methods--------"); //instance BoxManager boxManager = new BoxManager(); boxManager.Add(product1); boxManager.Add(product2); boxManager.Add2("Pear", "yellow", 12); }