当前位置: 首页>>代码示例>>C#>>正文


C# LineInfo.IndexOf方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:bittercoder,项目名称:FileHelpers,代码行数:34,代码来源:DelimitedField.cs

示例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;
		}
开发者ID:pjeconde,项目名称:CedForecast,代码行数:34,代码来源:DelimitedField.cs


注:本文中的FileHelpers.LineInfo.IndexOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。