예제 #1
0
        /// <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);
        }
예제 #2
0
 /// <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));
 }