I have a number of controls that inherit from a generic base class and this class implements an interface IMyInterface.
So far I tried:
var results = from c in this.Controls.Cast<Control>()
where c.GetType().GetInterfaces().Contains(typeof(IMyInterface))
select c as IMyInterface;
However, the above doesn't return any results even though it should.
How can I use Linq to get a list of controls on a form that implement this interface?