Why do they call the EventArgs parameter 'e'?

As we all know, .NET has very good documentation and variable / parameter names. Often you can figure out how to pass function parameters only to the variable names shown during development, without any consultation with the documentation. It’s very interesting to me that the only variable with an unrelated name is e , which is used in almost all declarations of event functions, such as:

private void button1_Click(object sender, EventArgs e)
private void button1_DragDrop(object sender, DragEventArgs e)

My question is why do they call all arguments of events e ? Is there a story behind this?

+4
source share
5 answers

Oh! It was a lazy Microsoft programmer :). Lolz jokes, this is a true Microsoft naming recommendation.

http://msdn.microsoft.com/en-us/library/h0eyck3s

This is what the third bullet says.

"Set two parameters named sender and e. The sender parameter represents the object that raised the event. The sender parameter always has an object of type, even if a more specific type can be used. The state associated with the event is encapsulated in an instance of the event class named e. Use the appropriate and a specific event class for parameter type e.

+5
source

e is short for the event, just as the arguments for the arguments are short, and I is short for the index.

+2
source

I think e is short for the event.

Or as someone else said. e means extra stuff!

+1
source

In fact, you need to give a more descriptive name, but it is so widely used, accepted and easy to understand that it is simply stuck.

0
source

e = event

This is unusual at first, but the human brain has such a good ability to adapt to almost anything that I think it’s not a real problem to call them e. Perhaps evt or event is more visual, but you should enter more characters again and again.

For example, the Euler number is also called the "e" instead of the "Euler number", to simplify things, save time from the life of mathematicians. This is not too descriptive, but people got used to it without problems, and this is only one character, so I think that it is fair enough for the event.

0
source

All Articles