public MessageSendCallSiteBinder AddBinder(MessageSendCallSiteBinder binder)
        {
            if (binder == null)
                throw new ArgumentNullException();

            MessageSendCallSiteBinder result;
            if (this.StrongCache.TryGetValue(binder.Selector.Value, out result))
            {
                // It is one of the common selectors
                if (result != null)
                    // Already cached
                    return result;
                // Cache it and return ...
                this.StrongCache.TryUpdate(binder.Selector.Value, binder, null);
                return this.StrongCache[binder.Selector.Value];
            }

            return this.WeakCache.AddItem(binder);
        }
 public MessageSendInvokeMemberBinder(MessageSendCallSiteBinder binder)
     : base(binder.NativeName, false, MessageSendInvokeMemberBinder.GetCallInfo(binder.ArgumentCount))
 {
     this.Binder = binder;
 }
            public MessageSendCallSiteBinder AddItem(MessageSendCallSiteBinder binder)
            {
                if (binder == null)
                    throw new ArgumentNullException();

                // 1. Try to get the CSB from the dictionary.
                binder.FinalizationManager = this;
                WeakReference reference = this._contents.GetOrAdd(binder.Selector.Value, na => new WeakReference(binder, false));
                // 2. Get the CSB from the weak reference holding it
                MessageSendCallSiteBinder result = reference.Target as MessageSendCallSiteBinder;
                // Once here, it can't be GC'ed.
                if (result != null)
                    // somebody else managed to put
                    return result;
                reference.Target = binder;
                return binder;
            }
 public MessageSendInvokeMemberBinder(MessageSendCallSiteBinder binder)
     : base(binder.NativeName, false, MessageSendInvokeMemberBinder.GetCallInfo(binder.ArgumentCount))
 {
     this.Binder = binder;
 }