Using e as a System.EventArgs in a CheckChanged CheckBox Event

please tell me the use of the e as System.EventArgs parameter in the CheckChanged CheckBox event

+3
source share
3 answers

You can ignore this one.

All events have the same signature: void handler(object sender, XxxEventArgs e)

Some events have more information and use a class derived from System.EventArgs for the second parameter.

For instance:

private void MainForm_KeyPress(object sender, KeyPressEventArgs e)
{
    char ch = e.KeyChar;
    ....
}
+4
source

System.EventArgs does not make sense.

From the documentation:

This class contains no event data; it is used by events that do not
pass state information to an event handler when an event is raised.
If the event handler requires state information, the application 
must derive a class from this class to hold the data.
+3
source

, , , .

( , EventArgs ( ) args)

-1

Source: https://habr.com/ru/post/1735282/


All Articles