I have an object with two different variables inside.
Looks like: ModelB.Text and ModelB.Value and ModelB.Attr
I also have a list of this object and I am loading this List<ModelB> with the data like this:
ModelB.Text = "Car";
ModelB.Value = "345.23";
ModelB.Text = "Car";
ModelB.Value = "343.23";
ModelB.Text = "Car";
ModelB.Value = "323.23";
ModelB.Text = "Toy";
ModelB.Value = "45.23";
ModelB.Text = "Toy";
ModelB.Value = "45.22";
ModelB.Text = "Toy";
ModelB.Value = "45.43";
What I want to do is to find the maximum an minimum valued cars, toys, etc. and check them like ModelB.Attr = "max"; or ModelB.Attr = "min";
So we have to mark the max an min of the each type of object. And yes all the data is string unfortunately and I am parsing it to decimal usually.
Well, I won’t bother here about parse error, culture and so on : these are business problems, not linq problem.
I don’t know either what to do if several objects have the same max value : mark them all or not, so I mark the first one. To mark them all, replace First by ForEach
EDIT : Here is the foreach implementation