CQRSSample.Infrastructure.Installers.EventHandlerHelper.AddItem C# (CSharp) 메소드

AddItem() 개인적인 정적인 메소드

private static AddItem ( IDictionary dictionary, Type type ) : void
dictionary IDictionary
type System.Type
리턴 void
        private static void AddItem(IDictionary<Type, IList<Type>> dictionary, Type type)
        {
            var theEvent = type.GetInterfaces()
                .Where(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(HandlesEvent<>))
                .First()
                .GetGenericArguments()
                .First();

            if (!dictionary.ContainsKey(theEvent))
                dictionary.Add(theEvent, new List<Type>());

            dictionary[theEvent].Add(type);
        }