コード例 #1
0
 public static void Main()
 {
     const string MessgaeFormat = "I am a {0} and my perimeter is {1:f2}. My surface is {2:f2}.";
     Figure circle = new Circle(5);
     Console.WriteLine(
         MessgaeFormat,
         circle.GetType().Name,
         circle.CalcPerimeter(),
         circle.CalcSurface());
     Figure rect = new Rectangle(2, 3);
     Console.WriteLine(
         MessgaeFormat,
         rect.GetType().Name,
         rect.CalcPerimeter(),
         rect.CalcSurface());
 }
コード例 #2
0
ファイル: FiguresExample.cs プロジェクト: Nachev/Telerik
        public static void Main()
        {
            const string MessgaeFormat = "I am a {0} and my perimeter is {1:f2}. My surface is {2:f2}.";
            Figure       circle        = new Circle(5);

            Console.WriteLine(
                MessgaeFormat,
                circle.GetType().Name,
                circle.CalcPerimeter(),
                circle.CalcSurface());
            Figure rect = new Rectangle(2, 3);

            Console.WriteLine(
                MessgaeFormat,
                rect.GetType().Name,
                rect.CalcPerimeter(),
                rect.CalcSurface());
        }