ref out

        static void Main(string[] args)
        {

            int a = 20;
            int b = 30;
            int c;
            SwapMethod(ref a, ref b);

            Console.WriteLine(" After Swap a is {0},b is {1} ", a, b);

            OutTest(out c);

            Console.WriteLine("The out value is {0}.", c);

        }

        static void SwapMethod(ref int a, ref int b)
        {
            int tem;
            tem = a;
            a = b;
            b = tem;
        }

        static void OutTest(out int a)
        {
            a = 10 * 10;
        }
View Code
原文地址:https://www.cnblogs.com/futengsheng/p/7837143.html