Design patterns Prototype Pattern Prototype Pattern (C#)


Example

The prototype pattern can be implemented using the ICloneable interface in .NET.

class Spoon {
}
class DessertSpoon : Spoon, ICloneable {
  ...
  public object Clone() {
    return this.MemberwiseClone();
  }
}
class SoupSpoon : Spoon, ICloneable {
  ...
  public object Clone() {
    return this.MemberwiseClone();
  }
}