private static void PrintFigure(IFigure figure) { string whoAmI = figure.WhoAmI(); string typeName = figure.GetType().Name; double area = figure.ComputeArea(); if (whoAmI != typeName) Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine( "WhoAmI = {0,-9} ; Имя класса {1,-9} ; Площадь={2:F2}", whoAmI, typeName, area ); Console.ResetColor(); }
private static void PrintFigure(IFigure figure) { string whoAmI = figure.WhoAmI(); string typeName = figure.GetType().Name; double area = figure.ComputeArea(); if (whoAmI != typeName) { Console.ForegroundColor = ConsoleColor.Red; } Console.WriteLine( "WhoAmI = {0,-9} ; Имя класса {1,-9} ; Площадь={2:F2}", whoAmI, typeName, area ); Console.ResetColor(); }