Understanding C# Events use of sender object

后端 未结 5 1050
时光说笑
时光说笑 2020-12-09 14:07

I am reasonably new to C# as a language (coming from a C++ background) and I am currently in the process of writing an application that makes use of an event driven API.

5条回答
  •  有刺的猬
    2020-12-09 14:41

    Just a note: If you have multiple different controls leading to the same method you can use

    ((Control)sender)
    

    to access it for every control, regardless the type of control (above it was just hardwritten, what object it has to be)

提交回复
热议问题