https://github.com/liteobject/demo.designpattern.prototype
An example of prototype design pattern in C#
https://github.com/liteobject/demo.designpattern.prototype
csharp design-patterns prototype-pattern
Last synced: 6 months ago
JSON representation
An example of prototype design pattern in C#
- Host: GitHub
- URL: https://github.com/liteobject/demo.designpattern.prototype
- Owner: LiteObject
- Created: 2023-08-01T13:08:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-01T14:16:03.000Z (over 2 years ago)
- Last Synced: 2025-05-21T19:13:50.853Z (8 months ago)
- Topics: csharp, design-patterns, prototype-pattern
- Language: C#
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prototype Design Pattern
The Prototype design pattern is a creational design pattern that provides a
way to create new objects by copying existing ones, rather than creating new
objects from scratch.
It allows you to create new objects by cloning an existing object that serves
as a prototype.
This pattern is useful when creating new objects is expensive in terms of
time and resources, and when the initialization process is complex or requires
external dependencies.
## Shallow Copy & Deep Copy
In programming, a copy of an object can be created using either a shallow copy
or a deep copy method. The difference between the two methods lies in how they
duplicate the original object.
The key difference between shallow copy and deep copy is that a shallow copy
creates a new object that points to the same memory location as the original
object, while a deep copy creates a new object with new memory that is an exact
replica of the original object.