Last active
August 29, 2015 14:06
-
-
Save lantoli/ad3c3aa2e3f6669ae06a to your computer and use it in GitHub Desktop.
Solution to reto 2 MSDN http://blogs.msdn.com/b/esmsdn/archive/2014/09/19/retosmsdn-reto-2-161-esos-eventos.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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