首页 > 代码库 > C# - Passing Reference-Type Parameters

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 theref or out keyword.

C# - Passing Reference-Type Parameters