static void Main(string[] args) { Cal <int> intcal = new Cal <int> { echo = 7 }; intcal.Display(new Action(() => Console.WriteLine(intcal.echo * intcal.echo))); Cal <Products> cal = new Cal <Products> { echo = new Products(7, 700, "Title7", "Owner7") }; cal.Display(new Action(() => Console.WriteLine($"Price {cal.echo.Price}"))); }
static void Main(string[] args) { Cal <int> echInt = new Cal <int> { echo = 9 }; Cal <Product> echProduct = new Cal <Product> { echo = new Product { ID = 4, Title = "MotorCycle", Price = 500 } }; Action intDisplay = () => { Console.WriteLine($"Square of 9: {echInt.echo * echInt.echo}."); }; Action productDisplay = () => { Console.WriteLine($"Price of {echProduct.echo.Title} is {echProduct.echo.Price}."); }; echInt.Display(intDisplay); echInt.Display(productDisplay); }