The call doesn't actually change the data but if it did would I need to
unbox the othingy back to the thingy if i wanted to manipulate the result.

Thanks.
Rob.

-----Original Message-----
From: Brad Wilson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 May 2002 10:14
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] ref and cast


Rolls, Robert wrote:

> so the call is

> Object othingy = thingy;
> DoTheCall( ref othingy);

> Why can't I simply cast thingy at the time of call to an object like so

> DoTheCall( ref (object)thingy );

Because it's a temporary. You'd never be able to get the changes back from
the call. The box gets created, a reference to it is passed, it's changed,
you come back, the box goes away (no more references to it). Changes
disappear. You could argue that it's prohibiting you from doing something
that might be exactly what you want; I can't disagree with that. :)

Brad

--
Read my web log at http://www.quality.nu/dotnetguy/

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.


**********************************************************************"
This correspondence is for the named person's use only. It may
contain confidential or legally privileged information or both. "
No confidentiality or privilege is waived or lost by any "
mistransmission.  If you receive this correspondence in error, please
immediately delete it from your system and notify the sender.  You
must not disclose, copy or rely on any part of this correspondence
if you are not the intended recipient.

Any views expressed in this message are those of the individual sender,
except where the sender expressly, and with authority, states them to
be the views of Vodafone.

This email has been checked for viruses.
**********************************************************************************************

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to