【发布时间】:2016-04-08 21:57:37
【问题描述】:
我有一堂课,代码如下:
Array tags;
if (lines.Length > 0)
{
configText = lines[0];
tags = new Array[lines.Length];
lines.CopyTo(tags,1);
}
这里出现以下错误:
目标数组不够长。检查 destindex 和长度和 数组的下界。
方法:
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;
}
【问题讨论】:
-
向我们展示整个代码。比如,“线条”的类型,它的内容等等