Explain current thinking around IClonable.
Answer Posted / 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 View All Answers
What is the adavantage of using ASP.NET routing?
Differentiate between structure and class.
Which Is Faster MVC or ASP.net ?
Define view state.
Why SessionID changes in every request in asp.net?
Explain State management in asp.net
What is Difference between Production Serves and Development Servers? And Suppose, m adding/deleting C# file in a project based on the Specific Requirement. These Files are Automatically updated in Production Servers? So Which tool is needed to do This One?
How can we provide the WebParts control functionality to a server control?
What is page fragment caching?
Explain difference between friend and protected friend?
Explain the difference between overriding and overloading?
Explain about asp.net state management?
Types of instancing properties and explain each. Tell the difference between multiuse,singleuse and globalmultiuse and which is default ?
How many types of state management are there in asp net?
What is session in asp.net?