private void TryAdd(Type key, ActionMethodDispatcher dispatchInfo)
 {
     if (delegates.ContainsKey(key))
     {
         throw new InvalidOperationException("Already registered a handler for " + key.FullName);
     }
     delegates.Add(key, dispatchInfo);
 }
 private void TryAdd(Type key, ActionMethodDispatcher dispatchInfo)
 {
     if (delegates.ContainsKey(key))
     {
         throw new InvalidOperationException("Already registered a handler for " + key.FullName);
     }
     delegates.Add(key, dispatchInfo);
 }
        private object[] ResolveParameters(ActionMethodDispatcher handler, object command, FastContainer childContainer)
        {
            var parameters = new object[handler.ParameterTypes.Count];

            for (int i = 0; i < parameters.Length; i++)
            {
                var parameterType = handler.ParameterTypes[i];
                if (parameterType == command.GetType())
                {
                    parameters[i] = command; // shortcut for command, it's a known type
                    continue;
                }
                parameters[i] = childContainer.Resolve(parameterType);
            }
            return(parameters);
        }