How do you implement prototype pattern in .NET?Prototype pattern is used to create copies of original instances known as clones. It is used when creating instances of a class is very complex.
In .Net, cloning can be achieved my making use of the ICloneable of the system namespace. Using the clone method, we can create clones or copies of instances with the same value of the existing instance. Shallow copy is used here which simply creates a reference of the original. Deep copy can be used when a duplicate instance needs to be created.
|