Explain current thinking around IClonable.



Explain current thinking around IClonable...

Answer / madhunathanv

*-->ICloneable is to create the copy of type instances.

*-->To create a true copy of a reference type,
you must clone the object to which it refers.

*-->The ICloneable interface identifies a type as cloneable
and declares the Clone method as the
mechanism through which you obtain a clone of an object.
*-->The Clone method takes no arguments
and returns a System.Object, regardless of the implementing
type. This means that once you clone
an object, you must explicitly cast the clone to the
correct type.


*-->If your custom type contains reference-type data
members, you must decide whether your Clone method will
perform a shallow copy or a deep copy.
*--> A shallow copy means that any referencetype
data members in the clone will refer to the same objects as
the equivalent reference-type data
members in the original object.
*--> A deep copy means that you must create clones of the
entire object graph so that the reference-type data members
of the clone refer to physically independent copies
(clones) of the objects referenced by the original object.

Note:Mostly Shallow Copy is being Preferred.Because A
shallow copy is easy to implement by calling the
MemberwiseClone method from within your
Clone method.
System.Xml.XmlNode implements
a deep copy in its Clone method

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

What is web.config. How many web.config files can be allowed to use in an application?

6 Answers   Accenture, HCL, InterGraph, iSoft,


Can a .net web application consume java web service?

0 Answers  


What is difference between URL and URI?

0 Answers   MCN Solutions,


What is the difference between ASP and ASP.NET?

4 Answers   Sans Pareil IT Services, TCS,


how to edit gridview control in asp.net2.0

1 Answers   3i Infotech,






How many Directives r in ASP.NET?

8 Answers  


How many types are there session

5 Answers   TCS,


What is clr? Difference between clr & cts?

0 Answers  


What for use web.sitemap in asp.net?

1 Answers  


What is web.config file ?

1 Answers  


In asp.net 3.5 we can go one page to onther page without using statemanagment concept?

1 Answers   ANR, Google, TCS,


What are navigation controls? How many navigation controls are there in ASP.NET 4.0?

0 Answers   UGC Corporation,


Categories