I have a class that's IEnumerable<T>
where I want to have different properties that provides a filtered IEnumerable<T>
access.
So for instance:
class Shape
ShapeType = Box/Sphere/Pyramid
class ShapeCollection : IEnumerable<Shape>
{
public IEnumerable<Shape> OnlyBox
{
foreach(var s in this)
{
if (s.ShapeType == Box)
yield return s;
}
}
}
Is this how it should be? Just not sure, about it completely.
Thanks.