LinqPad Crashed while evaluation data from sqlLite and csv.
I want to work with data from a csv file, sadly LinqPad crashes.
If I limit listFromCsv to 100 entries it works, but with 1000 entries it crashes again.
Any suggestions?
Extension:
If I limit listFromCsv to 100 entries it works, but with 1000 entries it crashes again.
Any suggestions?
Code:
var path = @c:\data.csv;
var listFromCsv = MyExtensions.ReadFrom(path).Skip(1).Select(x=>Int32.Parse(x)).ToList();
// Crash
MyTable.Where(a=>listFromCsv.Any(c=>c==a.Property )).Dump();
// No Crash
listFromCsv.Where(h=>MyTable.Any(x=>x.Property == h)).Dump();
Extension:
Code:
public static List<string> ReadFrom(string file)
{
List<string> lines = new List<string>();
string line;
using(var reader = File.OpenText(file))
{
while((line = reader.ReadLine()) != null)
{
lines.Add(line);
}
}
return lines;
}
Comments
You could also use File.ReadAllLines instead of ReadFrom.