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);
    }
}

No comments:

Post a Comment