若要使用 ref 参数,则方法定义和调用方法都必须显式使用 ref 关键字。例如: class RefExample { static void Method(ref int i) { i = 44; } static void Main() { int val = 0; Method(ref val); // val is now 44 } }