Click here to Skip to main content
15,887,464 members
Home / Discussions / C#
   

C#

 
GeneralRe: Custom Events Pin
#realJSOP11-Dec-08 12:15
mve#realJSOP11-Dec-08 12:15 
GeneralRe: Custom Events Pin
Mark Salsbery11-Dec-08 12:24
Mark Salsbery11-Dec-08 12:24 
AnswerRe: Custom Events Pin
PIEBALDconsult11-Dec-08 12:15
mvePIEBALDconsult11-Dec-08 12:15 
GeneralRe: Custom Events Pin
#realJSOP11-Dec-08 12:17
mve#realJSOP11-Dec-08 12:17 
GeneralRe: Custom Events Pin
PIEBALDconsult11-Dec-08 13:55
mvePIEBALDconsult11-Dec-08 13:55 
AnswerRe: Custom Events Pin
Christian Graus11-Dec-08 12:44
protectorChristian Graus11-Dec-08 12:44 
AnswerRe: Custom Events Pin
User 433002811-Dec-08 15:02
User 433002811-Dec-08 15:02 
AnswerRe: Custom Events Pin
DaveyM6912-Dec-08 2:25
professionalDaveyM6912-Dec-08 2:25 
It's designed that way, but I'm not sure why! Maybe they figured that people wouldn't be careful about null checking etc if they could just call an event directly but if they called the OnEvent it should be handled there? Just guessing!

I suppose the normal way (as you said) is the protected virtual void OnMyEvent(MyEventArgs e) method in the base and call that directly or override in the derived class.

Instead, you can mark the event as virtual in the base and override that in the derived class if you want.

BTW, it doesn't matter of course, but I normally use this if using my own event args, saves having to declare those delegates myself!:
public event EventHandler<MyEventArgs> MyEvent;


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

GeneralRe: Custom Events Pin
PIEBALDconsult12-Dec-08 3:06
mvePIEBALDconsult12-Dec-08 3:06 
GeneralRe: Custom Events Pin
DaveyM6912-Dec-08 3:11
professionalDaveyM6912-Dec-08 3:11 
GeneralRe: Custom Events Pin
PIEBALDconsult12-Dec-08 12:50
mvePIEBALDconsult12-Dec-08 12:50 
GeneralRe: Custom Events Pin
DaveyM6913-Dec-08 0:02
professionalDaveyM6913-Dec-08 0:02 
GeneralRe: Custom Events Pin
PIEBALDconsult13-Dec-08 4:04
mvePIEBALDconsult13-Dec-08 4:04 
GeneralRe: Custom Events Pin
DaveyM6913-Dec-08 4:12
professionalDaveyM6913-Dec-08 4:12 
QuestionProg to control other forms Pin
raylion11-Dec-08 9:53
raylion11-Dec-08 9:53 
AnswerRe: Prog to control other forms Pin
Christian Graus11-Dec-08 10:02
protectorChristian Graus11-Dec-08 10:02 
AnswerRe: Prog to control other forms Pin
Andreas Saurwein11-Dec-08 10:35
Andreas Saurwein11-Dec-08 10:35 
AnswerRe: Prog to control other forms Pin
Giorgi Dalakishvili11-Dec-08 19:26
mentorGiorgi Dalakishvili11-Dec-08 19:26 
QuestionSnapping Pin
bsaksida11-Dec-08 9:41
bsaksida11-Dec-08 9:41 
AnswerRe: Snapping Pin
Christian Graus11-Dec-08 9:52
protectorChristian Graus11-Dec-08 9:52 
QuestionC# App without App.Config Pin
shiftyninja11-Dec-08 9:00
shiftyninja11-Dec-08 9:00 
AnswerRe: C# App without App.Config Pin
Christian Graus11-Dec-08 9:21
protectorChristian Graus11-Dec-08 9:21 
GeneralRe: C# App without App.Config Pin
shiftyninja11-Dec-08 10:22
shiftyninja11-Dec-08 10:22 
AnswerRe: C# App without App.Config Pin
blackjack215011-Dec-08 9:56
blackjack215011-Dec-08 9:56 
GeneralRe: C# App without App.Config Pin
Christian Graus11-Dec-08 10:04
protectorChristian Graus11-Dec-08 10:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.