public static void Main()
Rectangle[] objects = new Rectangle[2];
objects[0] = new Rectangle() {Width = 10, Height =20};
objects[1] = new Rectangle() {Width = 5, Height =5};
Console.WriteLine("Area of objects: {0}", Area(objects));
public static double Area(Rectangle[] shapes)
foreach (var shape in shapes)
Rectangle rectangle = (Rectangle) shape;
area += rectangle.Width*rectangle.Height;
public double Width { get; set; }
public double Height { get; set; }