for( int i = 0; i< string[].length, i++ ) { UserBasicData[i]=ReadUserBasicData.GetString(i); }
public void (ref string s, ref string[] f) public string (ref string[] f) public string[](ref string f)传递到 ref 参数的参数必须最先初始化。将此方法与 out 参数相比,后者的参数在传递到 out 参数之前不必显式初始化。示例: static public void FillArray(out int[] myArray) { // Initialize the array: myArray = new int[5] {1, 2, 3, 4, 5}; }
use ref or out keyword in ur fuction args
你看看我给你例子,不就是out嘛! 把out或者ref去掉才是iN呢
好好看看关于函数定义的书 在函数定义中除了一般的 public int func(string strPara) { ... }还有 public int func(ref string strPara) { ... } 和 public int func(out string strPara) { ... } 两种,这两种就是使用引用传递来一个函数输出多个值的。
{
UserBasicData[i]=ReadUserBasicData.GetString(i);
}
public string (ref string[] f)
public string[](ref string f)传递到 ref 参数的参数必须最先初始化。将此方法与 out 参数相比,后者的参数在传递到 out 参数之前不必显式初始化。示例:
static public void FillArray(out int[] myArray)
{
// Initialize the array:
myArray = new int[5] {1, 2, 3, 4, 5};
}
把out或者ref去掉才是iN呢
在函数定义中除了一般的
public int func(string strPara)
{
...
}还有
public int func(ref string strPara)
{
...
}
和
public int func(out string strPara)
{
...
}
两种,这两种就是使用引用传递来一个函数输出多个值的。