The trouble is, events don't expose a "raise" operation* - they expose "subscribe" and "unsubscribe". It's up to the implementation how they implement subscribe/unsubscribe.
However, in the case of SaveFileDialog
(or any FileDialog
) there's the OnFileOk
protected method which will raise the event. You could either derive from SafeFileDialog
and expose a public method which will call OnFileOk
or just call OnFileOk
using reflection. That will then call the event handlers for FileOk
. I'm not sure I particularly like either of these plans of attack, but without more information about what you're trying to do I thought I'd just answer the question instead of questioning too much :)
*
In fact, .NET itself does have the idea of the "raise" part of an event, hence EventInfo.GetRaiseMethod
. However, this goes against the general idea of an event IMO, and the C# compiler never generates the raise part. I don't believe the standard libraries usually expose it either.