Post updated September 9th: you can win free Nokia devices during this session !
A short blog post to share some news about me… I will be speaking at Soft-Shake in Geneva later this October.
The session will be an introduction about Windows Phone 8 development and I will cover the following topics:
- Brief history of Windows Phone 8 and ModernUI
- Tooling (Visual Studio, Blend)
- Development story (C#/XAML, C++/DirectX)
- Tips and tricks (feedback from building my own app 2Day)
Soft-Shake is a 2 days event in Geneva with various tracks which make it very appealing for all of you (like me) who like to have a wide coverage of current technical (or not) subjects:
- Functional Programming
Thanks to Nokia I will have a few giveaways for the attendees. On top of fun and nice Nokia goodies for everyone 2 lucky people will go home with a brand new Windows Phone device to get started with development:
I hope to meet some of you there
Next Wednesday (November 9th), I’ll be at the Microsoft Days 11 as a member of the Ask The Expert team. I’ll be playing with the Samsung Slate I got at //BUILD/, discussing WPF, Silverlight, Windows Phone 7 and Windows 8.
Don’t hesitate to stop by and say hi if you’re coming to this event !
While reviewing some code at work the last days, I noticed I had a lot of similar methods I used to raise events. Basically, I did a test to check if the EventHandler is not null, and in this case, I raise the event:
// declaration of the event
public event EventHandler Saved;
// method I use to raise the event
private void OnSaved()
if (this.Saved != null)
In some of my classes, I had around 10 methods like this one to do the check, and raise the event if the associated event handler is not null. I was thinking about creating an extension method that would do this job for me… And actually, it’s very simple ! Here is the code:
/// Raise an event with a given EventArgs
/// <param name="handler">EventHandler to raised</param>
/// <param name="sender">Sender of the event</param>
/// <param name="e">Argument of the event</param>
public static void Raise(this EventHandler handler, object sender, EventArgs e)
if (handler != null)
Now, I can remove all methods that looks like the first I mentioned in the post, and simply write
I also created an overload of the extension method that does not supply an EventArgs (in case you want to use EventArgs.Empty) and also a generic version (in case you want to use an EventHandler).
You can download the associated class here.