Ejemplo n.º 1
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string)
     {
         return(ApiDateTime.Parse((string)value, null));
     }
     if (value is DateTime)
     {
         return(new ApiDateTime(null, (DateTime)value));
     }
     return(base.ConvertFrom(context, culture, value));
 }
Ejemplo n.º 2
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string @string)
     {
         return ApiDateTime.Parse(@string, null, null);
     }
     if (value is DateTime time)
     {
         return new ApiDateTime(null, null, time);
     }
     return base.ConvertFrom(context, culture, value);
 }