Monday, November 23, 2015

Passing By Value Vs By Ref C#

Avalue-typevariable
contains its data directly as opposed to areference-typevariable,
which contains a reference to its data. Passing a value-type variable to a
method by value means passing a copy of the variable to the method. Any changes
to the parameter that take place inside the method have no affect on the
original data stored in the argument variable. If you want the called method to
change the value of the parameter, you must pass it by reference, using thereforoutkeyword.
For simplicity, the following examples useref.