I\'m basically wanting to do this:
class UILockable : T
where T : UIWidget
{
}
However, this doesn\'t work. I\'ve seen people
You can't inherit from a Generic type argument. C# is strictly typed language. All types and inheritance hierarchy must be known at compile time. .Net generics are way different from C++ templates.
And when you're so sure that type argument T is going to be of type UIWidget then why not inherit from UIWidget itself. Should it ever be allowed [assuming, just assuming, I know this will never be possible] what would you achieve by inheriting your class from T that is already of type UIWidget. At design time, you'll only code against UIWidget, so why not directly inherit from UIWidget.