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


C# StreamReader.Lines方法代码示例

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


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

示例1: Read

 public DisassembledIl Read(Pathname path)
 {
   using (StringWriter writer = new StringWriter())
   {
     using (StreamReader reader = new StreamReader(path.AsString))
     {
       foreach (string line in reader.Lines())
       {
         writer.WriteLine(line);
       }
     }
     return new DisassembledIl(writer.ToString());
   }
 }
开发者ID:machine,项目名称:machine.hancock,代码行数:14,代码来源:IlReader.cs

示例2: Lines

 ///<summary>Streams the rows returned by the FileStream one at a time.</summary>
 public static IEnumerable<string> Lines(this FileStream me)
 {
     Contract.Requires(me != null);
     using(var reader = new StreamReader(me))
     {
         return reader.Lines().ToList();
     }
 }
开发者ID:RichieYang,项目名称:Composable.Monolithic,代码行数:9,代码来源:FileStreamExtensions.cs

示例3: FindValidWords

        // Decided it would be more efficient to use
        // the list of possible valid words from the dictionary and evaluate them then
        // against the keyboard Knight Move permutations using PLinq.
        private static string[] FindValidWords(Character[,] characterSet)
        {
            string fileName = @"..\..\Data\SINGLE.TXT";
            string[] filteredDictionary; // PLinq is more efficient with arrays.
            Keyboard board = new Keyboard(characterSet, SEARCH_DEPTH);

            using (StreamReader sr = new StreamReader(fileName))
            {
                filteredDictionary = sr.Lines().ToArray();
            }

            string[] finalWordList = (from word in filteredDictionary.AsParallel()
                                            .WithMergeOptions(ParallelMergeOptions.NotBuffered)
                                            .WithDegreeOfParallelism(Environment.ProcessorCount)
                                      where board.ValidateWord(new Word(word))
                                      select word).ToArray();

            return finalWordList;
        }
开发者ID:jeanhibbert,项目名称:FindWordsOnKeyboard,代码行数:22,代码来源:Program.cs

示例4: ExecuteTask

 /// <summary>
 /// Submits the form.
 /// </summary>
 protected override void ExecuteTask()
 {
     var wc = new WebClient();
     var nvc = CreateNameValueCollection(Fields);
     Log(Level.Info, "POSTing to '{0}' with {1} form fields.", Action, nvc.Count);
     var result = wc.UploadValues(Action, "POST", nvc);
     using (var resultStream = new MemoryStream(result))
     using (var sr = new StreamReader(resultStream))
     {
         foreach (var line in sr.Lines())
         {
             Log(Level.Verbose, line);
         }
     }
 }
开发者ID:olivierdagenais,项目名称:softwareninjas,代码行数:18,代码来源:PostTask.cs

示例5: GetHostfileContent

        /// <summary>Get the content of hosts file (or host file profile) with the specified <paramref name="filePath"/>.</summary>
        /// <param name="filePath">The path to the hosts file or an host file profile.</param>
        /// <returns>All lines from the hostfile with the specified <paramref name="filePath"/>.</returns>
        public List<string> GetHostfileContent(string filePath)
        {
            this.VerifyFile(filePath);

            using (var stream = new StreamReader(filePath))
            {
                return (from line in stream.Lines() select line).ToList();
            }
        }
开发者ID:andreaskoch,项目名称:Hostfile-Manager,代码行数:12,代码来源:HostfileDataAccess.cs

示例6: LinesTest

 public void LinesTest()
 {
     using (var sr = new StreamReader(_testStringsFile, true))
     Assert.AreEqual(sr.Lines().Count(), 10);
 }
开发者ID:ctimmons,项目名称:cs_utilities,代码行数:5,代码来源:FileIO.cs


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