Hello
I'm trying to store a text file into an array. The text should be stored separately depending on the indices as block.
I get the error message that the index was out of range. What am I doing wrong and how it would be correct?
int n
= 0;
FileStream stream = File.Open(path, FileMode.Open, FileAccess.ReadWrite);
StreamReader sr = new StreamReader(stream,
Encoding.Default);
StringCollection myStr = new StringCollection();
while (sr.ReadLine()
!= null)
{
myStr[n] += sr.ReadLine() + '\n';
if (sr.ReadLine()
== "") n++;
}
txtbAusgabe.Text = myStr[0];
sr.Close();