Never in all the years i worked with C# i seen this warning. My code is simple, so the big question is. What type of state is my List in? And why does this not happen to my second list that is100% equal?
// header section
public List<Item> SpecificItem = new List<Item>();
public List<Item> RandomeXItems= new List<Item>();
// in some object or Start void
if (RandomeXItems.Count > 0)
int MaxId = RandomeXItems.Max(i => i.ItemID); // InvalidOperationException
if (SpecificItem.Count > 0)
int MaxId = SpecificItem.Max(i => i.ItemID); // no errors and working
Make sense? (both lists are empty for test, same if items in them also, makes no difference)