Why do Revit Set classes only implement IEnumerable instead of IEnumerable<T>?
The Revit API contains lots of "Set" classes such as ParameterSet, ProjectLocationSet, PlanTopologySet, etc that only go as far as implementing IEnumerable. Is there any particular reason they don't implement IEnumerable<T> where T is underlying Revit class type?
I find myself always casting the set to the underlying type or explicitly defining the class when using for-each loops.
element.Parameters.Cast<Parameter>().Where(p => criteria);
foreach (Parameter p in element.Parameters) { // .. }
The fact that the Sets only implement IEnumerable makes me a bit nervous doing this. Is the above considered acceptable/safe code in Revit? Are there times when a Set like ParameterSet actually returns Objects that aren't Parameters? If so, please clarify when I might expect such an event.
Link copied