Use*_*007 3 c# arrays exception
我有一个包含以下代码的类:
Array tags;
if (lines.Length > 0)
{
configText = lines[0];
tags = new Array[lines.Length];
lines.CopyTo(tags,1);
}
Run Code Online (Sandbox Code Playgroud)
在这里我收到以下错误:
目标数组不够长.检查destindex和length以及数组的下限.
方法:
private bool ReadPointListFile(string fileName) {
// Read each line of the file into a string array. Each element
// of the array is one line of the file.
string[] lines = System.IO.File.ReadAllLines(fileName);
string configText = string.Empty;
if (lines.Length > 0)
{
configText = lines[0];
tags = new Array[lines.Length];
lines.CopyTo(tags,1);
}
else
lines.CopyTo(tags,0);
GetConfigurationInfo(lines[0], out this.sInterval, out this.dataAggregate);
return true;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8629 次 |
| 最近记录: |