ref关键字:
是用来修饰形参的,可以将值类型当做引用类型来使用
ref修饰的形参,在方法内部修改的时候,会影响实参的值
ref修饰的形参,在传参的时候,实参的值可以带入方法中
ref修饰的形参,在方法结束之前可以不赋值
out关键字:
out关键字:
用来修饰形参的,out修饰的形参必须在方法结束之前赋值
out修饰的形参,在方法内部进行修改的时候,会影响实参的值
out修饰的形参,在传参的时候,实参的值不会带入到方法中
out可以变相的使用多返回
class Program
{
    static void Main(string[] args)
    {
        int m = 10, n, x, y;
        Add(m, out n, out x, out y);
        int i = 10, j = 20;
        Change(ref i, ref j);
    }
    static void Change(ref int a, ref int b)
    {
        int temp = a;
        a = b;
        b = temp;
    }
    static void Add(int a,out int b,out int c,out int d)
    {
        b = 1;
        c = 2;
        d = 3;
    }
}
原文:http://www.cnblogs.com/xingyunge/p/6817526.html