用结构做为返回参数.
戓者使用ref关键字.
public struct param
{
  public int i;
  public string s;
}
public param aaa()
{
   param aa = new param();
   aa.i =10;
   aa.s ="sdfsdf";
   return aa;
}

解决方案 »

  1.   

    也可以这样的
    private  string aaa(string aaa,out string bbb,ref string ccc)
    {}
      

  2.   

    or use out, ref, or structureint GetValue(out int s, ref int s2)
    {
      s = s2 + 1;
      s2 = 12;
      return s+ s2;
    }int i;
    int j=2;
    int n = GetValue(out i, ref j);
      

  3.   

    public int MyMethod(ref int a, ref stirng b, out string c)
    {
    ...
    }用引用参数 ref和out, 这样, 你此函数可以得到4个返回值
      

  4.   

    ref 的参数, 对象的话,在进入函数前要实例化out参数,传入时可以是空的, 但传出时必须进行赋值操作,不管是不是给空值
      

  5.   

    利用输出参数out,它专门用来为函数传递返回数据
    void test( out int a, out char b, ... )
    {
       a = 1;
       b = 'b';
       ...
    }
      

  6.   

    用数组作为返回值
    public static string[,] GetGoal(string strName,int iYear)
    {
    // 定义
    string[,] strReturn=new string[6,3];
    for(int i=0;i<6;i++)
    {
    for(int j=0;j<3;j++)
    {
    strReturn[i,j]="";
    }
    }
    try
    {
    // 查询语句
    }
    catch
    {
    // 出现错误
    return null;
    }

    // 返回数组
    return strReturn;
    }
      

  7.   

    帮助里关于输出参数的说明:用 out 修饰符声明的参数是输出参数。类似于引用参数,输出参数不创建新的存储位置。相反,输出参数表示与在方法调用中作为参数给出的变量相同的存储位置。当形参为输出参数时,方法调用中的相应参数必须包含关键字 out,后跟与形参类型相同的变量引用(第 5.4 节)。变量在可以作为输出参数传递之前不需要明确赋值,但是在将变量作为输出参数传递的调用之后,变量被认为是明确赋值的。在方法内部,与局部变量相同,输出参数最初被认为是未赋值的,因而必须在使用它的值之前明确赋值。在方法返回之前,方法的每个输出参数都必须明确赋值。输出参数通常用在产生多个返回值的方法中。例如:class Test
    {
       static void SplitPath(string path, out string dir, out string name) 
       {
          int i = path.Length;
          while (i > 0) 
          {
             char ch = path[i – 1];
             if (ch == '\\' || ch == '/' || ch == ':') break;
             i--;
          }
          dir = path.Substring(0, i);
          name = path.Substring(i);
       }
       static void Main() 
       {
          string dir, name;
          SplitPath("c:\\Windows\\System\\hello.txt", out dir, out name);
          Console.WriteLine(dir);
          Console.WriteLine(name);
       }
    }
    此例产生下列输出:c:\Windows\System\
    hello.txt