Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminology - can events be "thrown"?

Twice this week, I've read people write that an event (.net) was "thrown". I've always thought that the verb to use with events is either "fire" or "raise". I thought that "thrown" was used for exceptions, but not events ("raise" can be used for either).

Does anyone else find it confusing for events to be "thrown"?

like image 261
Sean Avatar asked Mar 16 '09 14:03

Sean


5 Answers

I agree, events are raised/fired/triggered. If anything is thrown it's exceptions.

like image 179
Antony Scott Avatar answered Nov 02 '22 08:11

Antony Scott


The standard convention in the MSDN library seems to refer to Raising an Event and Throwing an Exception.

like image 31
rjzii Avatar answered Nov 02 '22 07:11

rjzii


One other term is "Invoked". Since events are delgates, they are Invoked to call them, but yes the general term is either "fired" or "raised".

Also, use of the word "throw" in this context is confusing, because it will be confused with the "throw" keyword. You can't throw an event with the throw keyword.

like image 37
Erik Funkenbusch Avatar answered Nov 02 '22 07:11

Erik Funkenbusch


Raise is the verb that seems to be most common in the MSDN docs.

I agree - if I hear that something was thrown, I assume it's an exception. The C# language makes that one very explicit - throw is a reserved word used with exceptions.

like image 3
Reed Copsey Avatar answered Nov 02 '22 08:11

Reed Copsey


Although it's possible to throw things that aren't exceptions, it's quite clear that throw is only meant to be used with exceptions. Raise is indeed the term you'd use for signifying that an event has happened.

like image 3
John Feminella Avatar answered Nov 02 '22 06:11

John Feminella