Define interface for loading custom UserControls through reflection
        Posted  
        
            by Tim
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Tim
        
        
        
        Published on 2010-05-18T13:01:34Z
        Indexed on 
            2010/05/18
            13:20 UTC
        
        
        Read the original article
        Hit count: 380
        
I'm loading custom user controls into my form using reflection. I would like all my user controls to have a "Start" and "End" method so they should all be like:
public interface IStartEnd
{
    void Start();
    void End();
}
public class AnotherControl : UserControl, IStartEnd
{            
    public void Start()
    { }
    public void End()
    { }
}
I would like an interface to load through reflection, but the following obviously wont work as an interface cannot inherit a class:
public interface IMyUserControls : UserControl, IInit, IDispose
{
}
© Stack Overflow or respective owner