[C#] 纯文本查看 复制代码
using System;
class App
{
public static void UseRef(ref int i)
{
i += 100;
Console.WriteLine("i = {0}", i);
}
static void Main()
{
int i = 10;
// 查看调用方法之前的值
Console.WriteLine("Before the method calling: i = {0}", i);
UseRef(ref i);
// 查看调用方法之后的值
Console.WriteLine("After the method calling: i = {0}", i);
Console.Read();
}
}