
Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Is a reference type value the same as an object?

Signature
Arne Garvander
(I program VB.Net for fun and C# to get paid.)
> > How do I pass a variable ByRef in C#?
>
[quoted text clipped - 4 lines]
> See http://www.pobox.com/~skeet/csharp/parameters.html for more
> information.
Jon Skeet [C# MVP] - 28 Apr 2006 20:56 GMT
> Is a reference type value the same as an object?
I expressed myself badly. When you have a variable whose type is a
reference type, the value of that variable is a reference. It's not the
object itself, it's a reference to the object. Suppose you had:
string x = "some very long string indeed which would be large etc";
then the value of x is just a reference - 4 or 8 bytes depending on
your platform. When you use x as an argument to a method, only 4 (or 8)
bytes are copied - the reference. The object itself is on the heap, and
the new copy of the reference points to the same object as the "old"
reference.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Barry Kelly - 28 Apr 2006 21:06 GMT
> Is a reference type value the same as an object?
Yes, anything declared with the 'class' keyword in C#.
-- Barry