How to add a delegate to an interface C#

前端 未结 6 1755
无人及你
无人及你 2021-01-30 07:42

I need to have some delegates in my class.

I\'d like to use the interface to \"remind\" me to set these delegates.

How to?

My class look like this:

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 08:46

    Since .NET 3.5 you can also use the System.Action delegates, without the need to declare your own type.

    This would result in the following interface:

    public interface myInterface
    {       
       // Implementing the IProcess interface
       event Action UpdateStatusText;
    
       event Action Started;
    }
    

提交回复
热议问题