我在该函数中取得了三个参数,应该怎样通过数组来返回?谢谢

解决方案 »

  1.   

    对象数组
    out
    不是对象参数的话拼字符串
    方法很多
      

  2.   

    public void abc(out a,out b,out c);
      

  3.   

    string [] aaa = new string(3);
    aaa[0] = var;
    aaa[1] = var;
    aaa[2] = var;
    return aaa;
      

  4.   

    也可以返回System.Collections.Specialized.NameValueCollection
      

  5.   

    out ,数组,或者返回一个对象
      

  6.   

    ArrayList List=new ArrayList()
    List.Add(Param1);
    List.Add(Param2);
    List.Add(Param3);
    return List
      

  7.   

    用 out 更会好点public void getOut(out type1 a, out type2 b, out type3 c)
    {
    a = ...;
    b = ...;
    c = ...;
    }调用时
    type1 a;
    type2 b;
    type3 c;getOut(a, b, c);
      

  8.   

    同意楼上,使用out会更好些,简洁且开销小
      

  9.   

    楼上的楼上正解,不过C# 1.1是如果传入的是对象,如果在方法体内部改变了这个对象,方法外面的值也会跟着修改。ExtObject ext;public void getOut(ExtObject ext)
    {
    ext.value = ...;
    }getOut(ext);
    System.console.write(ext.value); 
    方法体外面,这个值会变。
      

  10.   

    int getThreePara(out string a,out string b,out string c)
    {}