C#中ref和out 1.ref是传递参数的地址,out是返回值; 2.使用ref前必须对变量赋值(否则会出现"Use of unassigned local variable 'x' " 编译错误),out不用; 3.使用out的函数,退出函数时所有out变量都要赋值(不然会出现"The out parameter 'x' must be assigned to before control leaves the current method"编译错误);ref则不必; @:x 为相关参数