How to implement a cancel event in C#

后端 未结 5 1478
星月不相逢
星月不相逢 2021-02-12 12:28

I know that in C#, there are several built in events that pass a parameter (\"Cancel\") which if set to true will stop further execution in the object that raised the eve

5条回答
  •  遇见更好的自我
    2021-02-12 12:56

    Easy:

    1. Create an instance of CancelEventArgs (or your custom type).
    2. Raise the event, passing that instance.
    3. Check the Canceld property on [1].

    Do you need code samples?

提交回复
热议问题