Wednesday, November 09, 2005

ByRef vs. ByValue

In relation to passing object to methods:
The documentation says that all objects passed are by reference in Java. The Documentation for .Net says that all object variables in method calls by default are by value. They are in fact the same!

I think the names in .Net are a bit unaccurate. When you have an object by value, you actually have a value in the form of a reference. When you have an object by reference, you actually have a reference to a reference to an object. They should change their documentation to by reference being the name of the default behavior and changing ref and ByRef to something else.