コード例 #1
0
        internal object GetDestination(object source, Type destinationType)
        {
            object destination;

            InstanceCache.TryGetValue(new ContextCacheKey(source, destinationType), out destination);
            return(destination);
        }
コード例 #2
0
            public void Dispose()
            {
                if (Message != null)
                {
                    if (Message.ReuseId != ReuseId)
                    {
                        throw new InvalidOperationException("Double free detected for this message");
                    }

                    Message.ReuseId++;
                    Message.Reset();
                    lock (InstanceCache) {
                        if (InstanceCache.TryGetValue(Message.GetType(), out var queue))
                        {
                            queue.Enqueue(Message);
                        }
                    }
                }
            }