Esempio n. 1
0
        private HandlerList GetHandlerList(object instance)
        {
            if (TypeUtils.IsComObject(instance))
            {
                return(GetComHandlerList(instance));
            }


            if (_handlerLists == null)
            {
                Interlocked.CompareExchange(ref _handlerLists, new WeakDictionary <object, NormalHandlerList>(), null);
            }

            if (instance == null)
            {
                // targetting a static method, we'll use a random object
                // as our place holder here...
                instance = _staticTarget;
            }

            lock (_handlerLists) {
                NormalHandlerList result;
                if (_handlerLists.TryGetValue(instance, out result))
                {
                    return(result);
                }

                result = new NormalHandlerList();
                _handlerLists[instance] = result;
                return(result);
            }
        }
Esempio n. 2
0
        private HandlerList GetHandlerList(object instance) {
#if FEATURE_COM
            if (TypeUtils.IsComObject(instance)) {
                return GetComHandlerList(instance);
            }
#endif

            if (_handlerLists == null) {
                Interlocked.CompareExchange(ref _handlerLists, new WeakDictionary<object, NormalHandlerList>(), null);
            }

            if (instance == null) {
                // targetting a static method, we'll use a random object
                // as our place holder here...
                instance = _staticTarget;
            }

            lock (_handlerLists) {
                NormalHandlerList result;
                if (_handlerLists.TryGetValue(instance, out result)) {
                    return result;
                }

                result = new NormalHandlerList();
                _handlerLists[instance] = result;
                return result;
            }
        }
Esempio n. 3
0
        private HandlerList/*!*/ GetStubList(object instance) {
#if !SILVERLIGHT
            if (instance != null && ComOps.IsComObject(instance)) {
                return GetComStubList(instance);
            }
#endif

            if (_handlerLists == null) {
                System.Threading.Interlocked.CompareExchange(ref _handlerLists, new WeakDictionary<object, NormalHandlerList>(), null);
            }

            if (instance == null) {
                // targetting a static method, we'll use a random object
                // as our place holder here...
                instance = _staticTarget;
            }

            lock (_handlerLists) {
                NormalHandlerList result;
                if (_handlerLists.TryGetValue(instance, out result)) {
                    return result;
                }

                result = new NormalHandlerList();
                _handlerLists[instance] = result;
                return result;
            }
        }