<PackageReference Include="Castle.Windsor" Version="2.0.0" />

ArrayConverter

using Castle.Core.Configuration; using System; using System.Collections.Generic; using System.Diagnostics; namespace Castle.MicroKernel.SubSystems.Conversion { [Serializable] public class ArrayConverter : AbstractTypeConverter { public override bool CanHandleType(Type type) { return type.IsArray; } public override object PerformConversion(string value, Type targetType) { throw new NotImplementedException(); } public override object PerformConversion(IConfiguration configuration, Type targetType) { Debug.Assert(targetType.IsArray); int count = ((List<IConfiguration>)configuration.get_Children()).Count; Type elementType = targetType.GetElementType(); Array array = Array.CreateInstance(elementType, count); int num = 0; foreach (IConfiguration item in (List<IConfiguration>)configuration.get_Children()) { object value = base.Context.Composition.PerformConversion(item, elementType); array.SetValue(value, num++); } return array; } } }