【发布时间】:2014-09-15 15:57:01
【问题描述】:
我有一个方法,我需要调用我的一个方法并使用从该方法返回的字符串数组,但我传递的参数不正确。
这是我在我的方法中调用的方法..
public static string[] ReadFromFile(string filePath, int count, ref int lineCount)
{
lineCount += count;
return File.ReadLines(filePath).Skip(lineCount).Take(count).ToArray();
}
这是我传递的参数..
string filepath="C://Data";
int count;
int lineCount;
string[] arrline= ReadFromFile(filepath,count,lineCount);
请帮助我哪里错了。 谢谢..
【问题讨论】:
-
所有变量都是字符串,即使你想将它们用作计数器。
-
@TimSchmelter 对不起,他们是 int 。我更新了
-
现在你传递零作为计数,这意味着你想要
Take(0)行。
标签: c# methods parameters arguments