Ejemplo n.º 1
0
        public static void InvokeDelegateAsync(Delegate del, params object[] args)
        {
            if (del == null)
            { return; }

            AsyncCallback cleanUp = delegate(IAsyncResult asyncResult)
            {
                asyncResult.AsyncWaitHandle.Close();
            };

            AsyncFire asyncFire = new AsyncFire(InvokeDelegate);

            foreach (Delegate sink in del.GetInvocationList())
            {
                asyncFire.BeginInvoke(sink, args, cleanUp, null);
            }
        }