Published on November 13, 2017 by kudvenkat
Want create site? Find Free WordPress Themes and plugins.

In this video we will discuss
1. Significance of Copying
2. MemberwiseClone Method and ICloneable Interface
3. Prototype Design Pattern Example

Significance of Copying

1. The idea of using copy is to create a new object of the same type without knowing the exact type of the object we are invoking

2. Shallow Copy and Deep copy plays prominent role in copying the objects in Prototype Design Pattern

3. Creating the required object once and by creating the subsequent required objects by cloning helps reducing the time for creating the objects

4. With Prototype design pattern, based on the requirement situations we can save memory by cloning the objects
Example : Adapting to clone an object which consists of many strings (immutable) is a good idea than creating an object

MemberwiseClone and ICloneable Interface

MemberwiseClone Method :
1. The MemberwiseClone method is part of system.object and creates a shallow copy of the given object.

2. MemberwiseClone Method copies the nonstatic fields of the chosen object to the new object.

3. In the process of copying, if a field is a value type, a bit by bit copy of the field is performed. If a field is reference type, the reference is copied but the referenced object is not.

ICloneable Interface :
1. The ICloneable interface provides with a customized implementation that creates copy of an existing object.

2. The ICloneable interface contains one member, the clone method, which is intended to provide support beyond MemberwiseClone method.

Text version of the video


Design Patterns Tutorial playlist

Design Patterns Text articles and slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

Did you find apk for android? You can find new Free Android Games and apps.

Leave a Reply

1 Comment on "ProtoType Design Pattern Implementation"

Notify of

Merciful ARS
Merciful ARS
4 days 12 hours ago

Dear Sir,
Pls help me

1) When I select the row from gridview, then the Data will be move to textbox without select button.
2) Save the ID when I save the data but gridview show the Name.
3) Save with int and numeric.
4) How to one gridview to Another gridview data copy, checkbox select when Move button click then data move