Results 1 to 7 of 7

Thread: Cloning Objects

Hybrid View

  1. #1
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Cloning Objects

    As a rule of thumb, stuff that's serialisable is generally cloneable, and vice versa.

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2006
    Location
    Perth, Australia
    Posts
    55

    Re: Cloning Objects

    I understand that not every class should be clonable, namely value types. But surely every reference type should be? Why just the serialisable ones?

  3. #3
    Special Guest - Microsoft
    Join Date
    Dec 2007
    Posts
    3

    Re: Cloning Objects

    Quote Originally Posted by trezise
    I understand that not every class should be clonable, namely value types. But surely every reference type should be?
    In many cases, cloning can not be done by simply copying the content of an object because it wouldn't be the right thing to do. There is an obvious question of whether it should be a deep or a shallow copy. Also, cloning is likely to lead to sharing of resources and only author of the type has the knowledge about what would the sharing mean and how it should be handled, if supported at all. So, it is up to the author to decide whether cloning feature should be available and how exactly it is going to be implemented.

    Thanks,
    Aleksey Tsingauz,
    VB.NET Compiler Dev Team.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width