int x; Method3(ref x); Console.WriteLine("x is : {0}", x); Console.ReadKey(); static void Method3(ref int a) { a += 100; }
我面临这个错误!“错误 CS0165 使用未分配的局部变量‘x’”
使用该内存位置将值加到 100
c# function pass-by-reference
c# ×1
function ×1
pass-by-reference ×1