J
Jon Slaughter
I'm reading a book on C# and it says there are 4 ways of passing types:
1. Pass value type by value
2. Pass value type by reference
3. Pass reference by value
4. Pass reference by reference.
My interpretation:
1. Essentially pushes the value type on the stack
2. Boxes the value type? pushes a pointer to the value type on the stack
3. since a reference is essentially a pointer we are pushing the pointer of
the "reference"(object).
4. Boxing the reference type. Pushing a pointer to the reference type on the
stack.
so 1 is equivilent to 3 and 2 to 4 in the sense that the same idea is
involved but just the context is different? 1 and 3 pushes the actual type's
value while 2 and 4 push a pointer to the memory location of the value.
Thanks,
Jon
1. Pass value type by value
2. Pass value type by reference
3. Pass reference by value
4. Pass reference by reference.
My interpretation:
1. Essentially pushes the value type on the stack
2. Boxes the value type? pushes a pointer to the value type on the stack
3. since a reference is essentially a pointer we are pushing the pointer of
the "reference"(object).
4. Boxing the reference type. Pushing a pointer to the reference type on the
stack.
so 1 is equivilent to 3 and 2 to 4 in the sense that the same idea is
involved but just the context is different? 1 and 3 pushes the actual type's
value while 2 and 4 push a pointer to the memory location of the value.
Thanks,
Jon