MixinRegistration
using System;
using System.Collections;
using System.Collections.Generic;
namespace Castle.MicroKernel.Registration.Proxy
{
    public class MixinRegistration : IEnumerable<IReference<object>>, IEnumerable
    {
        private readonly IList<IReference<object>> items = new List<IReference<object>>();
        public MixinRegistration Component<TService>()
        {
            return Component(typeof(TService));
        }
        public MixinRegistration Component(Type serviceType)
        {
            if (serviceType == (Type)null)
                throw new ArgumentNullException("serviceType");
            items.Add(new ComponentReference<object>(serviceType));
            return this;
        }
        public MixinRegistration Component(string name)
        {
            if (name == null)
                throw new ArgumentNullException("name");
            items.Add(new ComponentReference<object>(name));
            return this;
        }
        public MixinRegistration Objects(params object[] objects)
        {
            foreach (object instance in objects) {
                items.Add(new InstanceReference<object>(instance));
            }
            return this;
        }
        IEnumerator IEnumerable.GetEnumerator()
        {
            return items.GetEnumerator();
        }
        IEnumerator<IReference<object>> IEnumerable<IReference<object>>.GetEnumerator()
        {
            return items.GetEnumerator();
        }
    }
}