Re: Why properties cannot be used as ref or out arguments

Dean Cleaver <[email protected]> Mon, 10 Mar 2008 22:33:48 +1300
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <4543A775711185429E59B18055D4167423225C@sxslakl004.xceptionsoftware.com>
Ah. Yes. Didn't think of the actual mechanics of how it presented the
properties behind it all. Thank you.

Is a shame though - or is there any way I can get around it using
delegates? I have a function that I require to set one of two
properties, and return a 3rd?

-----Original Message-----
From: Discussion of development on the .NET platform using any managed
language [mailto:[email protected]] On Behalf Of Ryan Heath
Sent: Monday, 10 March 2008 22:28
To: [email protected]
Subject: Re: [DOTNET-CLR] Why properties cannot be used as ref or out
arguments

Because properties are implemented underneath as functions.
get_PropName
set_PropName

A ref argument cannot point to a func, and if it did, it would point
to the wrong function in any case.

ref arg needs the passing value; it would need the get_PropName function
for it.
but ref arg needs to set the value as well; it would need the
set_PropName function for it.

HTH
// Ryan

On Mon, Mar 10, 2008 at 10:20 AM, Dean Cleaver
<[email protected]> wrote:
> I can understand ref arguments, because they might not be set on
> passing, but I can't figure out why they can't be used as out
arguments?
>
> Any thoughts?
>
> Dino
>
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> This list is hosted by DevelopMentor(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com