DataTable.AsEnumerable().ToList(); min/max return invalid if data is int
var list = ProcessedInformationTable.AsEnumerable().ToList();
var minValue = list.Min(v => v["Rank"]);
var maxValue = list.Max(v => v["Rank"]);
In the code above if I had the values of
ColumnA|Rank
Heart|9
Lung|10
minValue will return as 10 and maxvalue will return as 9. My guess is
because it's treated as a string even though every value is an int. Is
there a way around this?
No comments:
Post a Comment