Паттерны / Порождающие паттерны
image

using System;

var square = new Square("Red");
var maker = new ShapeMaker(square);

var square1 = maker.MakeShape();
var square2 = (Square)maker.MakeShape();

Console.WriteLine(square1.Color);
Console.WriteLine(square2.Color);

//Prototype
interface IShape {
    string Color { getset; }

    IShape Clone();
}

//ConcretePrototype
class Square : IShape {
    public string Color { getset; }

    public Square(string color) {
        Color = color;
    }

    public IShape Clone() {
        return new Square(Color);
    }
}

//Client
class ShapeMaker {
    private readonly IShape _shape;

    public ShapeMaker(IShape shape) {
        _shape = shape;
    }

    public IShape MakeShape() {
        return _shape.Clone();
    }
}


Описывает виды создаваемых объектов с помощью прототипа и создает новые объекты путем его копирования.