コード例 #1
0
        public override void Draw(ConsoleDrawer drawer)
        {
            // Code to draw a circle...
            Console.WriteLine("Drawing a circle");

            try
            {
                throw new FormatException();
            }
            catch
            {
            }

            base.Draw(drawer);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var shapes = new List <Shape>
            {
                new Rectangle(1, 1, 10, 10),
                new Triangle(2, 2, 10, 10),
                new Circle(3, 3, 10, 10),
                new Circle(4, 4, 10, 10),
                new Circle(5, 5, 10, 10),
            };

            #region BreakPoint
            for (int i = 0; i < shapes.Count; i++)
            {
                if (i % 2 == 0)
                {
                    Shape  shape    = shapes[i];
                    string message  = "This is my shape: ";
                    string message2 = "With a clean message";
                    Console.WriteLine(message + shape.ToString() + message2 + i);
                }
            }
            #endregion

            #region Exception
            ConsoleDrawer drawer = new ConsoleDrawer(1, "config", "config");
            foreach (Shape shape in shapes)
            {
                shape.Draw(drawer);
            }
            #endregion

            #region SpecialBreakPoint
            Shape rectangleShape = new Rectangle(x: 1, y: 2, height: 10, width: 200);
            for (int i = 0; i < 200; i++)
            {
                if (i / 2 == 50)
                {
                    rectangleShape.Move(x: 10, y: 20);
                }
            }
            #endregion

            Console.ReadLine();
        }
コード例 #3
0
 public virtual void Draw(ConsoleDrawer drawer)
 {
     Console.WriteLine("Performing base class drawing tasks");
 }
コード例 #4
0
 public override void Draw(ConsoleDrawer drawer)
 {
     // Code to draw a triangle...
     Console.WriteLine("Drawing a trangle");
     base.Draw(drawer);
 }