What is clone object and types?can give simple example ?and is possible call clone object to List ?
- 
                    It's something you should avoid. – H H Feb 11 '11 at 13:12
- 
                    @Henk - why should it be avoided? Its quite practical in some instances. – Daniel A. White Feb 11 '11 at 13:13
- 
                    possible duplicate of [What does it mean to clone() an object?](http://stackoverflow.com/questions/1749581/what-does-it-mean-to-clone-an-object) – H H Feb 11 '11 at 13:13
- 
                    possible duplicate of [Copy constructor versus Clone()](http://stackoverflow.com/questions/3345389/copy-constructor-versus-clone) – Josh Smeaton Feb 11 '11 at 13:14
- 
                    2There are hundreds of questions regarding cloning in .NET. Did you take the time to look at the questions that suggested the question may already have been asked? – Josh Smeaton Feb 11 '11 at 13:15
3 Answers
A clone is a copy (i.e. a new instance). Several BCL classes implement IClonable which returns an object which should be a new instance with the values of the original.
A good sample is at:
http://msdn.microsoft.com/en-us/library/system.icloneable.aspx
I don't think List<T> supports it, but you could add it, as long as the T are IClonable.
 
    
    - 187,200
- 47
- 362
- 445
Cloning means creating another instance of your Reference type (Anything that is not a constant [integers, chars...] or a structure) so you can modify one of them without affecting the other, as just using the Equals operator or passing one of such value types would create a pseudo-pointer.
To clone your classes, just make them implement ICloneable [http://msdn.microsoft.com/en-us/library/system.icloneable.aspx] and call the Clone() Method, casting the return type to the object type desired.
Good Luck :)
 
    
    - 3,637
- 3
- 30
- 53
 
     
    