Re: Returning an array in a property get returns a copy. How to get a reference?
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 12/06/04
- Next message: Tomas Vera: "Re: metadata operation failed (8013110E) : Database file is corrupt and may not be usable."
- Previous message: ChrisB: "Re: Managing Enumerations"
- In reply to: Faustino Dina: "Returning an array in a property get returns a copy. How to get a reference?"
- Next in thread: Bruce Wood: "Re: Returning an array in a property get returns a copy. How to get a reference?"
- Reply: Bruce Wood: "Re: Returning an array in a property get returns a copy. How to get a reference?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 6 Dec 2004 16:14:58 -0000
Faustino Dina <ffdina@matusa.com.mx> wrote:
> The following code is from an article published in Informit.com at
> http://www.informit.com/guides/content.asp?g=dotnet&seqNum=142. The problem
> is the author says it is not a good idea to return an array as a property
> because it will return a copy of the array instead a reference to it.
> How can I force the property to return a reference to the array?
The author is talking rubbish. It's returning a reference. I do wish
people who had no idea what they're talking about didn't write articles
on those topics :(
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Tomas Vera: "Re: metadata operation failed (8013110E) : Database file is corrupt and may not be usable."
- Previous message: ChrisB: "Re: Managing Enumerations"
- In reply to: Faustino Dina: "Returning an array in a property get returns a copy. How to get a reference?"
- Next in thread: Bruce Wood: "Re: Returning an array in a property get returns a copy. How to get a reference?"
- Reply: Bruce Wood: "Re: Returning an array in a property get returns a copy. How to get a reference?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|