ListConverter
using Castle.Core.Configuration;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace Castle.MicroKernel.SubSystems.Conversion
{
    [Serializable]
    public class ListConverter : AbstractTypeConverter
    {
        public override bool CanHandleType(Type type)
        {
            if (!(type == typeof(IList)))
                return type == typeof(ArrayList);
            return true;
        }
        public override object PerformConversion(string value, Type targetType)
        {
            throw new NotImplementedException();
        }
        public override object PerformConversion(IConfiguration configuration, Type targetType)
        {
            List<object> list = new List<object>();
            Type convertToType = GetConvertToType(configuration);
            foreach (IConfiguration item in (List<IConfiguration>)configuration.get_Children()) {
                list.Add(base.Context.Composition.PerformConversion(item.get_Value(), convertToType));
            }
            return list;
        }
        private Type GetConvertToType(IConfiguration configuration)
        {
            string text = ((NameValueCollection)configuration.get_Attributes())["type"];
            Type result = typeof(string);
            if (text != null)
                result = base.Context.Composition.PerformConversion<Type>(text);
            return result;
        }
    }
}