Castle.MicroKernel.SubSystems.Conversion.ArrayConverter.PerformConversion C# (CSharp) Method

PerformConversion() public method

public PerformConversion ( IConfiguration configuration, Type targetType ) : object
configuration IConfiguration
targetType System.Type
return object
		public override object PerformConversion(IConfiguration configuration, Type targetType)
		{
			System.Diagnostics.Debug.Assert(targetType.IsArray);

			int count = configuration.Children.Count;
			Type itemType = targetType.GetElementType();

			Array array = Array.CreateInstance(itemType, count);

			int index = 0;
			foreach(IConfiguration itemConfig in configuration.Children)
			{
				object value = Context.Composition.PerformConversion(itemConfig, itemType);
				array.SetValue(value, index++);
			}

			return array;
		}
	}

Same methods

ArrayConverter::PerformConversion ( String value, Type targetType ) : object