c# - parse lines using linq to txt -


  var t1 = From the row in the file ReadAllLines (@ "alkahf.txt") item = Row. (New string [] {"."}, StringSplitOptions.RemoveEmptyEntries) Poem = Line. Split (new string [] {"\ n."}, StringSplitOptions.RemoveEmptyEntries) Select new {index = item, text = verse};  

If there is a problem with the code above, I'm not sure how to parse the lines properly.

The format of the file is such, I would also like to ignore any empty line StringSplitOptions.RemoveEmptyEntries does not work for any reason

  1 in this text can be number I. In the LINQ section, you     

That's why you may want to exhaust the blank lines:

  From the line in the file Reed Allines (@ "Alcataphtect") where! String.IsOlOrequity (line)  

Then you split two - on a new line, which is strange (because there will not be, because we know we are reading the line). I hope you mean something like this:

  bears = line Sample ('.') Where the parts Long == 2 Select new {index = parts [0], text = part [1]};  

?

Also, keep in mind that ReadAllLines is a buffer action; If you want true streaming, then you want something like this:

  Public stable IEnumerable & lt; String & gt; ReadLines (string path) {{var reader = File. Open text (path) {string string; While ((Line = Reader. Readline ()) = Null () yield yield line; }}}  

which is not buffering (you do not load the entire file at a time) just change the first line to the following:

  in readline From the row (@ "Alaquehf.text")  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -