Friday, April 4, 2014

Reading text from a file as blocks

You can use the add() member to put a string into the collection.

Simplified example:



string line = "";
while ((line = sr.ReadLine()) != null)
{
myStr.Add(line + '\n');
}

for (int x = 0; x < myStr.Count; ++x)
{
Console.WriteLine(myStr[x]);
}

- Wayne


No comments:

Post a Comment