Beispiel #1
0
        public virtual bool Equals(BinderHash other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            var tArgNames      = ArgNames;
            var tOtherArgNames = other.ArgNames;

            return
                (!(tOtherArgNames == null ^ tArgNames == null) &&
                 other.IsEvent == IsEvent &&
                 other.StaticContext == StaticContext &&
                 Equals(other.Context, Context) &&
                 Equals(other.BinderType, BinderType) &&
                 Equals(other.DelegateType, DelegateType) &&
                 Equals(other.Name, Name) &&
                 (tArgNames == null
                  // ReSharper disable AssignNullToNotNullAttribute
                  //Exclusive Or Makes Sure this doesn't happen
                  || tOtherArgNames.SequenceEqual(tArgNames)));
            // ReSharper restore AssignNullToNotNullAttribute
        }
Beispiel #2
0
        public virtual bool Equals(BinderHash other)
        {
            if (ReferenceEquals(null, other)) {
                return false;
            }
            if (ReferenceEquals(this, other)) {
                return true;
            }

            var tArgNames = ArgNames;
            var tOtherArgNames = other.ArgNames;

            return
                !(tOtherArgNames == null ^ tArgNames == null)
                    && other.IsEvent == IsEvent
                        && other.StaticContext == StaticContext
                            && Equals(other.Context, Context)
                                && Equals(other.BinderType, BinderType)
                                    && Equals(other.DelegateType, DelegateType)
                                        && Equals(other.Name, Name)
                                            && (tArgNames == null
                                                // ReSharper disable AssignNullToNotNullAttribute
                                                //Exclusive Or Makes Sure this doesn't happen
                                                || tOtherArgNames.SequenceEqual(tArgNames));
            // ReSharper restore AssignNullToNotNullAttribute
        }
Beispiel #3
0
        internal static CallSite CreateCallSite(
            Type delegateType,
            Type specificBinderType,
            LazyBinder binder,
            String_OR_InvokeMemberName name,
            Type context,
            string[] argNames  = null,
            bool staticContext = false,
            bool isEvent       = false
            )
        {
            var tHash = BinderHash.Create(delegateType, name, context, argNames, specificBinderType, staticContext, isEvent);

            lock (_binderCacheLock) {
                CallSite tOut;
                if (!_binderCache.TryGetValue(tHash, out tOut))
                {
                    tOut = CallSite.Create(delegateType, binder());
                    _binderCache[tHash] = tOut;
                }
                return(tOut);
            }
        }