Пример #1
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object obj)
 {
     if (obj == null)
     {
         return(DoubleCy.Zero);
     }
     if (obj is string)
     {
         return(DoubleCy.Parse((string)obj, culture));
     }
     if (obj is Currency)
     {
         return((DoubleCy)((Currency)obj));
     }
     if (obj is decimal)
     {
         return((DoubleCy)((decimal)obj));
     }
     if (obj is double)
     {
         return(new DoubleCy((double)obj));
     }
     if (obj is int)
     {
         return((DoubleCy)((int)obj));
     }
     if (obj is long)
     {
         return((DoubleCy)((long)obj));
     }
     return(base.ConvertFrom(context, culture, obj));
 }
Пример #2
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object obj, Type type)
 {
     if ((obj != null) && (type == typeof(string)))
     {
         DoubleCy cy = (DoubleCy)obj;
         return(cy.ToString(null, culture));
     }
     return(base.ConvertFrom(context, culture, obj));
 }
Пример #3
0
        public override bool IsValid(ITypeDescriptorContext context, object value)
        {
            DoubleCy cy = (DoubleCy)value;

            return(cy.IsValid());
        }