Skip to content

Instantly share code, notes, and snippets.

@lantoli
Last active August 29, 2015 14:06
Show Gist options
  • Save lantoli/ad3c3aa2e3f6669ae06a to your computer and use it in GitHub Desktop.
Save lantoli/ad3c3aa2e3f6669ae06a to your computer and use it in GitHub Desktop.
// Leo Antoli solution to reto 2 MSDN: http://blogs.msdn.com/b/esmsdn/archive/2014/09/19/retosmsdn-reto-2-161-esos-eventos.aspx
using System;
using System.Linq;
namespace Reto2ClassLibrary
{
public class Reto2 : IReto2
{
public event EventHandler EventFired;
public void FireEvent() {
if (EventFired != null) {
foreach (var evt in EventFired.GetInvocationList().
Where(x => x.Target is Item).
OrderBy(x => (x.Target as Item).Index)) {
evt.DynamicInvoke(this, null);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment