As your input files are apparently small, you can do the following: use
System.IO.File.ReadAllLines
(instead of
ReadAllText
. This method returns your an array of strings each representing, surprisingly, a line. Access array elements by index and use the line(s) you need.
Please see:
http://msdn.microsoft.com/en-us/library/system.io.file.readalllines.aspx[
^].
[EDIT]
gogole_yuna asked:
what if my txt file is big..?
Then you would simply use
System.IO.StreamReader
with the method
ReadLine
. Count lines as you read. Pick the one(s) you need. Please see:
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx[
^].
—SA