Re: ValueType reference in objects
- From: "parez" <psawant@xxxxxxxxx>
- Date: 22 Nov 2006 12:25:41 -0800
Hey
You could try creating a custom integer class and pass it to the your
cons instead of int
Peter Duniho wrote:
"Andre Azevedo" <Andre Azevedo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6C65D414-810D-4827-97D1-08D25BA4E48D@xxxxxxxxxxxxxxxx
C# copies the value from the i variable to the object heap field i.
Is this correct? Heap object doesn´t point to stack variables?
No, it doesn't. There might be a way to generate a reference to a local
variable, but if there is I don't know what it is, and for sure the code you
posted doesn't. Except, of course, as the "by reference" parameter in the
constructor...but in that case, you still can't access the reference
directly, it just means that if you change the value of the parameter in the
constructor, the original variable passed in is changed as well. That
behavior does not extend to other values to which the parameter is assigned.
Pete
.
- References:
- Re: ValueType reference in objects
- From: Peter Duniho
- Re: ValueType reference in objects
- Prev by Date: Get Calling Class type in base clases static method.
- Next by Date: Re: try...catch and local variables
- Previous by thread: Re: ValueType reference in objects
- Next by thread: Re: ValueType reference in objects
- Index(es):
Relevant Pages
|