用out或ref
bool myFunc(string sDataSource, string sDatabase, string sUsername, string sPassword, out string sRefreshTime);bool myFunc(string sDataSource, string sDatabase, string sUsername, string sPassword, ref string sRefreshTime);

解决方案 »

  1.   

    C#的很多类型都是引用类型,只有基本类型和struct才是值类型,只有对于值类型才需要使用out ref,其他的引用类型是不需要的ref的
      

  2.   

    out和ref略有区别
    An overload will occur if declarations of two methods differ only in their use of out. However, it is not possible to define an overload that only differs by ref and out
      

  3.   

    引用类型就是指向内存地址的值类型用ref 或 out
      

  4.   

    不同意 IceboundRock()的关于“只有对于值类型才需要使用out ref,其他的引用类型是不需要的ref的”看法。
      

  5.   

    out,调用前可以不赋值,但从方法返回前必须赋值ref,正好相反
      

  6.   

    to  hsb0307(hsb8704066):
    你看看这个程序就知道了。
    using System;
    using System.Collections;
    class myTrim
    {
    public static void Main()
    {
              
    ArrayList al = new ArrayList();
    test(al);
    Console.WriteLine((int)al[0]);
    Console.Read();
    return;
    } public static void test(ArrayList al)
    {
    al.Add(1);
    }
    }