using System.Collections.Generic;
public static void Main(string[] args)
List<Figure> lista = new List<Figure>();
List<Circle> circles = new List<Circle>();
circles.Add(new Circle { X = 1, Y = 2, Radius = 3 });
circles.Add(new Circle { X = 2, Y = 15, Radius = 1 });
List<Square> squares = new List<Square>();
squares.Add(new Square { X = 3, Y = 7, Length = 15 });
squares.Add(new Square { X = 3, Y = 10, Length = 23 });
squares.Add(new Square { X = 7, Y = 0, Length = 2 });
foreach(Circle circle in circles) {
item.Radius = circle.Radius;
item.TypeFigure = "Circle";
foreach(Square square in squares) {
item.Length = square.Length;
item.TypeFigure = "Square";
foreach(Figure figure in lista) {
public int X { get; set; }
public int Y { get; set; }
public int Radius { get; set; }
Console.WriteLine(String.Format("Circle: {0} {1} {2}", X, Y, Radius));
public int X { get; set; }
public int Y { get; set; }
public int Length { get; set; }
Console.WriteLine(String.Format("Square: {0} {1} {2}", X, Y, Length));
public int X { get; set; }
public int Y { get; set; }
public int Length { get; set; }
public int Radius { get; set; }
public string TypeFigure { get; set; }
Console.WriteLine(String.Format("{0} : {1} {2} {3}", TypeFigure, X, Y, (TypeFigure == "Circle" ? Radius :Length)));