예제 #1
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value == null)
                {
                    return(null);
                }
                var castValue = value as DictionaryElementCollection;

                if (castValue == null)
                {
                    return(base.ConvertFrom(context, culture, value));
                }
                var dict      = new Dictionary <string, Convertible>();
                var converter = new ConvertibleConverter();

                foreach (var item in castValue)
                {
                    dict[item.Key] = (Convertible)converter.ConvertFrom(item.Value);
                }
                return(dict);
            }
예제 #2
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value == null)
                {
                    return(null);
                }
                var castValue = value as ListElementCollection;

                if (castValue == null)
                {
                    return(base.ConvertFrom(context, culture, value));
                }
                var list      = new List <Convertible>();
                var converter = new ConvertibleConverter();

                foreach (var item in castValue)
                {
                    list.Add((Convertible)converter.ConvertFrom(item.Value));
                }
                return(list);
            }
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value == null)
                {
                    return(null);
                }

                if (!(value is ConfiguredListParameter castValue))
                {
                    return(base.ConvertFrom(context, culture, value));
                }

                var list      = new List <Convertible>();
                var converter = new ConvertibleConverter();

                foreach (string item in castValue.List)
                {
                    list.Add((Convertible)converter.ConvertFrom(item));
                }

                return(list);
            }
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value == null)
     {
         return null;
     }
     var castValue = value as ConfiguredListParameter;
     if (castValue == null)
     {
         return base.ConvertFrom(context, culture, value);
     }
     var list = new List<Convertible>();
     var converter = new ConvertibleConverter();
     foreach (var item in castValue.List)
     {
         list.Add((Convertible)converter.ConvertFrom(item));
     }
     return list;
 }
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value == null)
     {
         return null;
     }
     var castValue = value as ConfiguredDictionaryParameter;
     if (castValue == null)
     {
         return base.ConvertFrom(context, culture, value);
     }
     var dict = new Dictionary<string, Convertible>();
     var converter = new ConvertibleConverter();
     foreach (var item in castValue.Dictionary)
     {
         dict[item.Key] = (Convertible)converter.ConvertFrom(item.Value);
     }
     return dict;
 }