Can I declare an Interface (i.e. IMySpecialControl) that requires classes implementing it to also inherit from some base class (i.e. System.Windows.Controls.UserControl)?
My thinking is that, no, this is not possible. But it would be really nice to write client code in such a way that it only takes a 'IMySpecialControl' which defines several members it cares about and it can count on that object also being a UserControl that it can then add to the GUI or manipulate.
I know that I can always check if the object instance defined as a 'IMySpecialControl' is also a UserControl, but I was hoping there might be some slick trick in .Net I'm not aware of. :-)
Can I declare an Interface (i.e. IMySpecialControl) that requires classes implementing it to also inherit from some base class (i.e. System.Windows.Controls.UserControl)?
No, there's nothing in C# which defines that.
It would probably be simplest to create an abstract subclass of UserControl
instead.
What you can do is have a generic method or type with a restriction that the type parameter implements an interface and is compatible with a class:
public void Foo<T>(T control) where T : UserControl, IMySpecialControl
I don't know whether that's helpful in your particular case, but it's the closest you can get to your original requirement.
See more on this question at Stackoverflow