コード例 #1
0
        public static IFigure GetFigure(FigureType type)
        {
            switch (type)
            {
            case FigureType.Circle:
                return(Circle.Create());

            case FigureType.Rectangle:
                return(Rectangle.Create());

            case FigureType.Triangle:
                return(Triangle.Create());
            }
            return(UnknownFigure.Create());
        }
コード例 #2
0
        public static IFigure GetFigure(string type)
        {
            switch (type)
            {
            case "Circle":
                return(Circle.Create());

            case "Rectangle":
                return(Rectangle.Create());

            case "Triangle":
                return(Triangle.Create());
            }
            return(UnknownFigure.Create());
        }