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

ArrayConverter

using Castle.Core.Configuration; using System; 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) { int count = configuration.Children.Count; Type elementType = targetType.GetElementType(); Array array = Array.CreateInstance(elementType, count); int num = 0; foreach (IConfiguration child in configuration.Children) { object value = base.Context.Composition.PerformConversion(child, elementType); array.SetValue(value, num++); } return array; } } }