/// <inheritdoc /> public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (parameter == null) { return(value); } var count = ConverterHelper.TryConvertToInt32(parameter, culture); return(count.HasValue ? value.ToEnumerable <object>().Take(count.Value) : value); }
/// <inheritdoc/> public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(targetType == typeof(int) ? ConverterHelper.ConvertToInt32(value, culture) : ConverterHelper.TryConvertToInt32(value, culture)); }