Re: Passing arguements by reference
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Mon, 27 Feb 2006 07:23:22 -0000
Mark R. Dawson <MarkRDawson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I understood everything upto the code above, You say its passed by
reference, but doSomething doesnt change p unless i use "ref"? Surely
that is by value then? :-/
The subtle point to note is that the underlying object is passed by
reference, hence both p and q pointing to the same object, not to different
object BUT the actual variable which points to the object is copied when you
don't use the ref keyword.
Passing a reference by value *isn't* passing an object by reference.
It's similar, I admit - but there are very specific meanings for the
teams, and they're not the same thing.
(This is compounded by the fact that no expression is actually an
object in C#.)
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- References:
- Passing arguements by reference
- From: Andrew Bullock
- RE: Passing arguements by reference
- From: Mark R. Dawson
- Re: Passing arguements by reference
- From: Andrew Bullock
- Re: Passing arguements by reference
- From: Mark R. Dawson
- Passing arguements by reference
- Prev by Date: Add an item to a ListBox from a ComboBox
- Next by Date: Re: Generics, constraints and overloading
- Previous by thread: Re: Passing arguements by reference
- Next by thread: Re: Passing arguements by reference
- Index(es):
Relevant Pages
|
|