public static void Main()
        {
            int x = 10;
            int y = 20;
            int value,value1,value2;

            value = Add(x, y);
            Console.WriteLine(value);
            Console.WriteLine(x);
            Console.WriteLine(y);
            Console.WriteLine();

            value = Add(x: 1,y: 9);
            Console.WriteLine(value);
            Console.WriteLine(x);
            Console.WriteLine(y);
            Console.WriteLine();

            value = AddAndReset(ref x, ref y);
            Console.WriteLine(value);
            Console.WriteLine(x);
            Console.WriteLine(y);
            Console.WriteLine();

            value2 = AddAndSubtract(20, 10, out value1);
            Console.WriteLine(value1);
            Console.WriteLine(value2);
            Console.WriteLine();

            Console.WriteLine(AddAll(new int[] {1,4,7,9 }));
            Console.WriteLine(AddAll(1,4,7,9));
            Console.WriteLine();

            Console.WriteLine(AddTwo(3));
            Console.WriteLine();

            var product = new Product {
                Name = "Tie",
                Price = 10,
                Category = "Clothes"
            };
            ResetProductCategory(product);
            Console.WriteLine(product);
            ResetProduct(ref product);
            Console.WriteLine(product);

            Console.ReadLine();
        }
        public static void Main()
        {
            var object1 = new { };
            var object2 = new { };
            var object3 = new { Id = "A001" };
            var object4 = new { Id = "A002" };
            var product = new Product { Name = "SomeProduct" };
            object2 = object1;  //legal
            object3 = object4;  //legal
            //object2 = object3;  //error
            //object2 = product;  //error
            Console.WriteLine(object3.Id);
            Console.WriteLine(product.Name);

            var list = new[] {
                new {Id="1"},
                new {Id="2"}
            };

            foreach (var item in list) {
                Console.Write(item.Id + ", ");
            }
            Console.WriteLine();
        }
 static void ResetProductCategory(Product product)
 {
     product.Category = "UNASSIGNED";
     //below operation will not be visible for the caller
     product = new Product {
         Name = "UNNAMED",
         Price = 0,
         Category = "UNASSIGNED"
     };
 }
 static void ResetProduct(ref Product product)
 {
     product = new Product {
         Name = "UNNAMED",
         Price = 0,
         Category = "UNASSIGNED"
     };
 }