I'm working with .NET Compact Framework and just started to refactor some UI code. I'm defining a base user control to encapsulate common functionality, the project compiles OK but when I try to open a child user control in design mode I'm getting an error.
I made my class hierarchy taking into account this question. My classes are like this:
//on the data layer..
interface IDataObject {}
class Foo: IDataObject {}
//on the UI layer i have
class BaseDataUserControl<TDataObject> : UserControl
where TDataObject : IDataObject {}
class FooUserControl : BaseDataUserControl<Foo> {}
This is the error I'm getting:
GenericArguments[0], 'Foo', on 'BaseDataUserControl`1[TDataObject]' violates the constraint of type 'TDataObject'
Can anyone point out to me why this does not work?