
正文
C# - Passing Reference-Type Parameters
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
A variable of a reference type does not contain its data directly; it contains a reference to its data.
When you pass a reference-type parameter by value, it is possible to change the data pointed to
by the reference, such as the value of a class member. However, you cannot change the value of the reference itself; that is, you cannot use the same reference to allocate memory for a new class and have it persist outside the block.
To do that, pass
the parameter using the
ref
or
out
keyword.








