如我想返回
bool a1=true;
string a2="abcdefg";请问这个方法怎么写?

解决方案 »

  1.   

    用out或者ref,或者自定义一个结构
      

  2.   

    class Test
    {
      public bool Method1()
      {
        return true;
      }  public string Method2()
      {
        return "abcdefg";
      }
    }
      

  3.   

    class Test
    {
      public bool Method1()
      {
        return true;
      }  public string Method2()
      {
        return "abcdefg";
      }
    }
      

  4.   


    public void SetValue(out bool a1,out string a2)
    {
        
    }
      

  5.   

    string a2=string.Empty;
    bool a1=aaa(a2);
    public bool aaa(out string a)
    {
    a="abcdefg";
    retutn true;
    }
      

  6.   

    public string getstr(ref bool a1)
    {
      a1 = true;
      return "abcdefg";
    }
      

  7.   

    struct ZXXX
    {
      bool a1; 
      string a2; 
    }return ZXXX;
      

  8.   

    解决方法太多你甚至可以返回个hashtable    或把bool值和string值,拼在一个字符串返回 ,比如“true,abcdefg”
      

  9.   

    返回array也是可以的。。多少类型都行。。