Writing these may be thought of as "pattern-mode". Insus.net thought that every master might have to do it before he became a master.
Walk, began to learn from childhood, until now, who is not to walk to walk? Always repeating ...
Many people do not share their experience, share their own process, share this thing, it will not be because of sharing less ...
Touched by the story, because of the sharing of the course and let people moved ...
Design patterns, in the ASP. NET development process, indeed a lot of environmental applications, perhaps only because of time and efficiency problems, the use of the most direct method to solve. Often brought about by the maintenance of complex becomes difficult to carry out.
To enter the subject, first look at this article "mouse click, copy the GridView Control data row" http://www.cnblogs.com/insus/p/3680461.html the user click on the row to copy. In fact, its implementation of the method is to filter the original data.
In the prototype design pattern, the original object is cloned.
Declaring an abstract class or interface, in which one method is to clone itself:
Create a container that stores all the processed objects:
The actual object is to be implemented as a prototype abstract class:
Here is the copy of the object when the row is clicked:
Final Result:
The above method, select the row, copy one, if the selection is saved up:
Demo, this time, just a little bit, just copy one:
However, perhaps what you need is to click on a clone once, once selected, no longer stored:
Real-time demo, no matter how many times you choose, only one object is stored:
Source code Download:
Http://download.cnblogs.com/insus/CSharpNET/prototype_pattern.rar
Design mode-prototype (Prototype) mode