Delegates and events in the frontend?

Can we implement delegates and events in the interface?

+1


a source to share


1 answer


You can specify an event in an interface, but you cannot declare a delegate (or any other type) - at least not in C #. For instance:



// Valid
public delegate void BarHandler(object sender, EventArgs e);        
public interface IFoo
{
    event BarHandler Bar;
}

// Invalid
public interface IFoo
{
    delegate void BarHandler(object sender, EventArgs e);        
    event BarHandler Bar;
}

      

+6


a source







All Articles