I have a class in my code that is already deriving from IEnumerable.
I was wondering if there is a way that I can use a “Contains” method on its instnaces to look for a something in that list?
I have a class in my code that is already deriving from IEnumerable. I
Share
Do you really implement the non-generic
IEnumerable, or the genericIEnumerable<T>? If you can possibly implement the generic one, your life will become a lot simpler – as then you can use LINQ to Objects, which does indeed have aContainsextension method.Otherwise, you could potentially convert from the non-generic to generic using
CastorOfType, e.g.It would be nicer if you just implemented the generic interface to start with though 🙂