Microsoft.ManagementConsole.AsyncDelegateQueue.BeginInvoke C# (CSharp) Method

BeginInvoke() public method

public BeginInvoke ( Delegate method, object args ) : IAsyncResult
method System.Delegate
args object
return IAsyncResult
        public IAsyncResult BeginInvoke(Delegate method, object[] args)
        {
            AsyncDelegate delegate2 = new AsyncDelegate(method, args);
            if (!this.InvokeRequired)
            {
                delegate2.Execute(true);
                return delegate2;
            }
            BeginInvokeCommand command = null;
            lock (this.SyncRoot)
            {
                int key = this._nextInvokeId++;
                this._pendingDelegates.Add(key, delegate2);
                if (this._snapInPlatform != null)
                {
                    command = new BeginInvokeCommand();
                    command.Id = key;
                }
            }
            if (command != null)
            {
                this._snapInPlatform.ProcessCommand(command);
            }
            return delegate2;
        }