using System;
class test
{
    static string sr ( )
    {
        string a ,b ;        a = Console.ReadLine ( );
        b = Console.ReadLine ( );
        return a+ b;
    }
}

解决方案 »

  1.   

    using System;
    class test
    {
        static string sr ( string a ,b )
        {
            string a ,b ;        a = Console.ReadLine ( );
            b = Console.ReadLine ( );
            return a b;
        }
        static void Main ( )
        {
            string a;
            sr(a,b);
            Console.WriteLine ( a +b);
           
        }
    }
            是这样,没理解我的意思,就是要返回两个值,好像以前C++可以返回的.
      

  2.   

    可以,建议楼主去看一下,有关ref,in,out关键字...
    举个例子:
    static void GetStr(ref string str1, ref string str2)
            {
                str1 = "str1";
                str2 = "str2";
            }
    static void Main(string[] args)
            {
                string str1 = null ;
                string str2 = null ;
                GetStr(ref str1,ref  str2);
                Console.WriteLine(str1 + str2);
            }输出:str1str2
      

  3.   

    using System;
    class test
    {
        static void sr ( out string a,out string b )
        {
                    a = Console.ReadLine ( );
            b = Console.ReadLine ( );
           
        }
        static void Main ( )
        {
            string a , b;
            sr(out a,out b);
            Console.WriteLine ( a+b);
           
        }
    }
            
    照楼上的说,我重写了下,谢谢你了,一语惊醒梦中人呀.
      

  4.   

    嗯,还可以用ref
    用out和用ref的效果差不多的...