本文整理汇总了C#中FileHelpers.LineInfo.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# LineInfo.IndexOf方法的具体用法?C# LineInfo.IndexOf怎么用?C# LineInfo.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelpers.LineInfo
的用法示例。
在下文中一共展示了LineInfo.IndexOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BasicExtractString
private ExtractedInfo BasicExtractString(LineInfo line)
{
if (IsLast && ! IsArray)
return new ExtractedInfo(line);
else
{
int sepPos;
sepPos = line.IndexOf(mSeparator);
if (sepPos == -1)
{
if (IsLast && IsArray)
return new ExtractedInfo(line);
if (NextIsOptional == false)
{
string msg;
if (IsFirst && line.EmptyFromPos())
msg = string.Format("The line {0} is empty. Maybe you need to use the attribute [IgnoreEmptyLines] in your record class.", line.mReader.LineNumber);
else
msg = string.Format("Delimiter '{0}' not found after field '{1}' (the record has less fields, the delimiter is wrong or the next field must be marked as optional).", mSeparator, this.FieldInfo.Name, line.mReader.LineNumber);
throw new FileHelpersException(line.mReader.LineNumber, line.mCurrentPos, msg);
}
else
sepPos = line.mLine.Length;
}
return new ExtractedInfo(line, sepPos);
}
}
示例2: BasicExtractString
private ExtractedInfo BasicExtractString(LineInfo line)
{
ExtractedInfo res;
if (mIsLast)
res = new ExtractedInfo(line);
else
{
int sepPos;
sepPos = line.IndexOf(mSeparator);
if (sepPos == -1)
{
if (this.mNextIsOptional == false)
{
string msg = null;
if (mIsFirst && line.EmptyFromPos())
msg = "The line " + line.mReader.LineNumber.ToString() + " is empty. Maybe you need to use the attribute [IgnoreEmptyLines] in your record class.";
else
msg = "The delimiter '" + this.mSeparator + "' can´t be found after the field '" + this.mFieldInfo.Name + "' at line " + line.mReader.LineNumber.ToString() + " (the record has less fields, the delimiter is wrong or the next field must be marked as optional).";
throw new FileHelpersException(msg);
}
else
sepPos = line.mLine.Length - 1;
}
res = new ExtractedInfo(line, sepPos);
}
return res;
}