I'm trying to extract a subset of a list based on a property. That property is itself a collection and I'm only interested in the values where this collection is not null
My code is:
var subGroupCollection = groupContext.SubGroups.Where(sg => sg.Holds != null).ToList();
I get the following run-time error:
Cannot compare elements of type 'System.Collections.Generic.ICollection`1[[WW2.Hold, WW2, Version=6.0.5848.30559, Culture=neutral, PublicKeyToken=null]]'. Only primitive types, enumeration types and entity types are supported.
"Holds" is the name of the collection property(this is a HashSet of Hold objects)
What's the issue here and is there an obvious solution?
sg.Holds.Count() > 0orsg.Holds.Any()? - entropic