what is meant by shallow copying in .net ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nagmvs
    New Member
    • Aug 2008
    • 49

    what is meant by shallow copying in .net ?

    Please explain shallow copying in .net
  • Hugo Dahl
    New Member
    • Oct 2010
    • 2

    #2
    The difference between a "shallow" copy and a "deep" copy is in the number of levels of nested objects/items are copied.

    For example, presume you have a object with a structure as follows:

    Person
    -FirstName (string)
    -LastName (string)
    -PhoneNumber (string)
    -Children (Collection<Pers on>)

    In the case of a shallow copy, only the FirstName, LastName and PhoneNumber (first level properties) would/should be copied. In the case of a deep copy, you would recurse through all the child objects and create copies of those as well into the new object.

    Comment

    • nagmvs
      New Member
      • Aug 2008
      • 49

      #3
      Thanku for ur reply hugo.

      Comment

      Working...