Search code examples
c#genericsuser-controls

C# generics usercontrol


I would like to define the following control:

public partial class ObjectSelectorControl<T> : UserControl where T : class 

The problem is that the designer can't resolve this. Is there a workaround to this issue?


Solution

  • This works

    public class Control1<T> : UserControl { ... }
    
    public class Control2 : Control1<double> { ... }
    
    public class Control3 : Control2 { ... }
    

    had read it here:

    Generic User Controls?