GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 29 of 50    Print  
Shallow and Deep Copy
What is shallow and deep copy in C#? How to perform the same in C#?


  
Total Answers and Comments: 2 Last Update: January 09, 2010     Asked by: a_sahayam_811572 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 20, 2008 03:40:55   
gopi2008 Member Since: May 2006   Contribution: 3    

RE: Shallow and Deep Copy
shallow copy copies the structure of the object deep copy copies structure as well as data.

For example consider an object called X that references objects A and B. Object B in turn references object C. A shallow copy of X creates new object X2 that also references objects A and B. In contrast a deep copy of X creates a new object X2 that references the new objects A2 and B2 which are copies of A and B. B2 in turn references the new object C2 which is a copy C. Use a class that implements the ICloneable interface to perform a deep or shallow copy of an object.

 
Is this answer useful? Yes | No
January 09, 2010 13:06:28   
ebabu Member Since: December 2009   Contribution: 5    

RE: Shallow and Deep Copy
Shallow copy make a copy of data along with it's reference for example object A has property name by making a shallow copy to object B and changes the name property value that will reflect in object A.

Deep copy is one which copies only the data and not it reference. there will not be any impact on name property of object A when the object B's chnaged.

To achive deep copy IClonable.Clone() method needs to implmented. which shloud have the implementation of this.memberwiseClone().

 
Is this answer useful? Yes | No

 Related Questions

I am copying some data from a shared folder in network(VLAN) the band width of the VLAN is 2 mbps(not effective)So when I am copying a file of around 10 mb in between the network breaks or packet lossesand I am not able to copy the entire thing.What should I do

What is shallow and deep copy in C#? How to perform the same in C#? 
Latest Answer : Shallow copy make a copy of data along with it's reference, for example object A has property name, by making a shallow copy to object B, and changes the name property value that will reflect in object A.Deep copy is one which copies only the data ...


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.  By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.  IT Certification offers several vari
 

Neuro-linguistic Programming Methods

Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
 

The Difficult Past of Neuro-linguistic programming

The Difficult Past of Neuro linguistic programming Neuro linguistic programming has had a rocky past with a number of lawsuits rivalry unsystematic development and intermittent progress During the 1980s the two founders separated after the lawsuit filed by Bandler Bandler went on to file several law
 

History of Neuro Linguistic Programming (NLP)

History of Neuro linguistic programming Neuro Linguistic Programming NLP is a system co founded by John Grinder and Richard Bandler for bringing about personal development in any individual by interpreting and translating the human perception experience beliefs and language It was developed in early
 

The Use of Access Specifiers In Object Oriented Programming

The Use of Access Specifiers In Object Oriented Programming In object oriented programming a variable will have a certain range This range can be defined as the place where it can be viewed In most cases there are two simple models that are used and these are lexically scoped and dynamically scoped
 

Class-based Object Oriented Programming

Class based Object Oriented Programming Class based object oriented programming is a style that gains inheritance by processing classes as objects The most prominent style of OOP is class based instead of object based With the class based OOP system objects are units that merge states identities and
 

A Object Oriented Programming Lesson For Beginners

A Object Oriented Programming Lesson For Beginners In this article I will go over object oriented programming in relation to PHP This article will be especially useful to those who already have a simple knowledge of programming and variables You should know what a variable is and you should also kno
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape