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


C# TextReader.ReadLines方法代码示例

本文整理汇总了C#中System.IO.TextReader.ReadLines方法的典型用法代码示例。如果您正苦于以下问题:C# TextReader.ReadLines方法的具体用法?C# TextReader.ReadLines怎么用?C# TextReader.ReadLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.TextReader的用法示例。


在下文中一共展示了TextReader.ReadLines方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

        public static IEnumerable<GoogleCodeIssue> Parse(TextReader reader)
        {
            Debug.Assert(reader != null);

            var firstLine = reader.ReadLine();
            if (string.IsNullOrEmpty(firstLine))
                return Enumerable.Empty<GoogleCodeIssue>();

            var headers = ParseValues(firstLine).ToArray();

            var bindings = Enum.GetNames(typeof(GoogleCodeIssue.IssueField))
                .Select(n => Array.FindIndex(headers, h => n.Equals(h, StringComparison.OrdinalIgnoreCase)))
                .Select(i => (Func<IEnumerable<string>, string>)(values => values.ElementAtOrDefault(i) ?? string.Empty))
                .ToArray();

            return //...
                from line in reader.ReadLines()
                let values = ParseValues(line).ToArray()
                let id = ParseInteger(bindings[(int)GoogleCodeIssue.IssueField.Id](values), CultureInfo.InvariantCulture)
                where id != null && id.Value > 0
                let issue = new GoogleCodeIssue
                {
                    Id = id.Value,
                    Type = bindings[(int)GoogleCodeIssue.IssueField.Type](values),
                    Status = bindings[(int)GoogleCodeIssue.IssueField.Status](values),
                    Milestone = bindings[(int)GoogleCodeIssue.IssueField.Milestone](values),
                    Priority = bindings[(int)GoogleCodeIssue.IssueField.Priority](values),
                    Stars = bindings[(int)GoogleCodeIssue.IssueField.Stars](values),
                    Owner = bindings[(int)GoogleCodeIssue.IssueField.Owner](values),
                    Summary = bindings[(int)GoogleCodeIssue.IssueField.Summary](values)
                }
                select issue;
        }
开发者ID:csware,项目名称:GurtleReloaded,代码行数:33,代码来源:IssueTableParser.cs

示例2: ParseFileText

 public static IEnumerable<VectorPairs> ParseFileText(TextReader stringReader)
 {
     return stringReader
         .ReadLines()
         .Skip(1)
         .ChunkBySize(3)
         .Select(problem => ParseProblem(problem[1], problem[2]));
 }
开发者ID:adampridmore,项目名称:GoogleJammin,代码行数:8,代码来源:Problem2.cs

示例3: Parse

 /// <summary>
 /// Parses the TZDB time zone info file from the given reader and merges its information
 /// with the given database. The reader is not closed or disposed.
 /// </summary>
 /// <param name="reader">The reader to read.</param>
 /// <param name="database">The database to fill.</param>
 internal void Parse(TextReader reader, TzdbDatabase database)
 {
     string currentZone = null;
     foreach (var line in reader.ReadLines())
     {
         currentZone = ParseLine(line, currentZone, database);
     }
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:14,代码来源:TzdbZoneInfoParser.cs

示例4: TryParseAsDynamic

 public static bool TryParseAsDynamic(TextReader textReader, out object dynamicValue)
 {
     HRONDynamicParseError[] errors;
     return HRONSerializer.TryParseDynamic(
         int.MaxValue,
         textReader.ReadLines().Select(s => s.ToSubString()),
         out dynamicValue,
         out errors
         );
 }
开发者ID:mbjarland,项目名称:hron,代码行数:10,代码来源:HRONSerialization.cs

示例5: TryParse

        public static bool TryParse(TextReader textReader, IVisitor visitor)
        {
            if (visitor == null)
            {
                return false;
            }

            var translatingVisitor = new TranslatingVisitor(visitor);
            HRONSerializer.Parse(
                int.MaxValue,
                textReader.ReadLines().Select(s => s.ToSubString()),
                translatingVisitor
                );
            return translatingVisitor.ErrorCount == 0;
        }
开发者ID:mbjarland,项目名称:hron,代码行数:15,代码来源:HRONSerialization.cs


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