System.Net.CallbackClosure.IsCompatible C# (CSharp) Method

IsCompatible() private method

private IsCompatible ( AsyncCallback callback ) : bool
callback AsyncCallback
return bool
        internal bool IsCompatible(AsyncCallback callback)
        {
            if (callback == null || _savedCallback == null)
            {
                return false;
            }

            // Delegates handle this ok.  AsyncCallback is sealed and immutable, so if this succeeds, we are safe to use
            // the passed-in instance.
            if (!object.Equals(_savedCallback, callback))
            {
                return false;
            }

            return true;
        }

Usage Example

Beispiel #1
0
        internal bool FinishPostingAsyncOp(ref CallbackClosure closure)
        {
            ExecutionContext context;

            if ((this._Flags & (StateFlags.PostBlockFinished | StateFlags.PostBlockStarted)) != StateFlags.PostBlockStarted)
            {
                return(false);
            }
            this._Flags |= StateFlags.PostBlockFinished;
            CallbackClosure closure2 = closure;

            if (closure2 == null)
            {
                context = null;
            }
            else if (!closure2.IsCompatible(base.AsyncCallback))
            {
                closure = null;
                context = null;
            }
            else
            {
                base.AsyncCallback = closure2.AsyncCallback;
                context            = closure2.Context;
            }
            bool flag = this.CaptureOrComplete(ref context, true);

            if (((closure == null) && (base.AsyncCallback != null)) && (context != null))
            {
                closure = new CallbackClosure(context, base.AsyncCallback);
            }
            return(flag);
        }
All Usage Examples Of System.Net.CallbackClosure::IsCompatible