I wrote a static method which reads scientific numbers(X,Y) from a text file and put them in a List of list<double>. But I don't know why the next value from file override all other values.
IF != 100 - 100 is first value of text file and its only property for my program.
static List<List<double>> DownloadData(string path1)
{
List<List<double>> lista = new List<List<double>>();
List<double> doubelowa = new List<double>();
doubelowa.Clear();
string line = null;
try
{
using (TextReader sr = File.OpenText(path1))
{
while ((line = sr.ReadLine()) != null)
{
doubelowa.Clear();
if (line != "100")
{
var d = line.Split().Select(f => double.Parse(f, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture));
doubelowa.AddRange(d);
lista.Add(doubelowa);
}
}
}
}
finally
{
}
return lista;
}
Before I wrote this method and it worked great. But now when I write more and more code I don't know what changed. I try fix it but...
Its screen with locals: https://onedrive.live.com/redir?resid=DF3242C9A565ECD1!4549&authkey=!AEDu90t1iNQj4MY&v=3&ithint=photo%2cpng
For some reason the double.clear() clear the value of list Lista. Why?