(1) 两者都是按地址传递的,使用后都将改变原来的数值
(2) ref传进去的参数必须在调用前初始化,out不必(3) ref传进去的参数在函数内部可以直接使用,而out不可
(4) ref传进去的参数在函数内部可以不被修改,但out必须在离开函数体前进行赋值
(5) ref是有进有出,out是只出不进
string outString = "This is the original outString";
Console.WriteLine(outString);
outMethod(out outString);
Console.WriteLine(outString);
string refString = "This is the original ref string";
Console.WriteLine(refString);
refMethod(ref refString);
Console.WriteLine(refString);