Пример #1
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         string s = null;
         return(ExtensibleEntityHelper.GetString(ref s, (ExtensionData)value));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Пример #2
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string s)
     {
         Dictionary <string, string> d = null;
         ExtensibleEntityHelper.Enumerate(s, ref d);
         return(d?.Count > 0 ? new ExtensionData(d) : null);
     }
     return(base.ConvertFrom(context, culture, value));
 }