I want to populate the arraylist with the contents of the file. now it reads the first line and adds it to 0 and reads the next line and again writes it to 0, so basically it keeps overwriting itself. how can i make it add to the next avail element?
ArrayList files = new ArrayList();
StreamReader sr = new StreamReader("C:\\TestFile.txt");
String line;
while ((line = sr.ReadLine()) != null)
{
files.Add(sr.ReadLine());
for (int i=0; i<files.Count; i++)
{
files.Add(sr.ReadLine());
}
}
sr.Close();