Using the "ref" modifier. Note that it's rarely necessary, as reference
type values are already references. (Those references are passed by
value, however.)
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.
Yes, anything declared with the 'class' keyword in C#.
-- Barry
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.