Thursday, August 25, 2011

C# Invoke particular EventHandler in InvocationList

I am trying to get particular EventHandler get fired.

Event ProjectChanged was hooked by several EventHandlers


public static event EventHandler ProjectChanged;


foreach (var eventHandler in ProjectChanged.GetInvocationList())
{
    if (eventHandler.Method.Name == "UserContext_ProjectChanged")
    {
        eventHandler.DynamicInvoke(null,null);
    }
}

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Online Training from India. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
    JavaScript Online Training from India

    ReplyDelete