本文整理汇总了C#中TextLine.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# TextLine.GetEnumerator方法的具体用法?C# TextLine.GetEnumerator怎么用?C# TextLine.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLine
的用法示例。
在下文中一共展示了TextLine.GetEnumerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CSVSheet
CSVSheet(string filePath, TextLine textLine)
{
Assert.IsTrue(textLine != null);
this.filePath = filePath;
using (var lines = textLine.GetEnumerator())
{
lines.MoveNext();
string colNames = lines.Current;
lines.MoveNext();
string colTypes = lines.Current;
this.columnInfo = new ColumnInfo(colNames, colTypes, filePath);
List<RowData> tempList = new List<RowData>();
while (lines.MoveNext())
{
string line = lines.Current;
if (!string.IsNullOrEmpty(line))
{
var tokens = line.Split(',');
var newRow = new RowData(tokens);
Assert.IsTrue(newRow.IsValidInLength(columnInfo), string.Format("tokens.Length={0}, columnInfo.Length={1} in \n{2}", tokens.Length, columnInfo.Length, line));
int errIndex;
Assert.IsTrue(newRow.IsValidInType(columnInfo, out errIndex), errIndex < 0 ? string.Empty : string.Format("Converting error: [{0}] to {1} in {2}", tokens[errIndex], columnInfo[errIndex].Value, filePath));
tempList.Add(newRow);
}
}
rows = tempList;
}
}
示例2: TableGenerator
TableGenerator(string resPath, string className)
{
TextAsset csvFile = Resources.Load(resPath) as TextAsset;
Assert.IsTrue(csvFile != null, "File not found: " + resPath);
TextLine textLine = new TextLine(csvFile.text);
Assert.IsTrue(textLine != null);
using (var lines = textLine.GetEnumerator())
{
lines.MoveNext();
string colNames = lines.Current;
lines.MoveNext();
string colTypes = lines.Current;
this.columnInfo = new ColumnInfo(colNames, colTypes, resPath);
}
this.className = className;
}