fidel <(E-Mail Removed)> wrote:
> yep - if you create a struct and pass it to a function, it will be just
> be a copy. so the function can modify it till it's heart's content, and
> it wont affect the original struct.
Unless, of course, a member of the struct is a mutable reference
type... it's worth clarifying that when a struct value is copied, it's
only a shallow copy.
> If you tried the same with a class though, you would be passing it "by
> reference" so to speak, and therefore that method could modify it.
Note that it's not *really* passed by reference. That means something
different, and is available with the "ref" keyword.
See
http://www.pobox.com/~skeet/csharp/parameters.html
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too