C# ref and out


The reference parameter is declared with the keyword ref. A reference parameter does not declare a new storage location. Any change in the reference parameter directly changes the corresponding argument.

Example

Before call of the method A= 3
The value inside method:23
After call of the method A= 23
__

The out parameter is similar to a reference parameter, except that the initial value of the argument is unimportant. An output parameter is declared with an out modifier

Example

The out C Value is: 20
__