Ejemplo n.º 1
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is TValue tValue)
            {
                return(ValueOf <TValue, TThis> .From(tValue));
            }

            if (value is DateTime date && typeof(TValue) == typeof(string) && date.ToString("o") is TValue stringValue)
            {
                return(ValueOf <TValue, TThis> .From(stringValue));
            }

            return(base.ConvertFrom(context, culture, value));
        }
Ejemplo n.º 2
0
 protected virtual bool Equals(ValueOf <TValue, TThis> other)
 {
     return(EqualityComparer <TValue> .Default.Equals(this.Value, other.Value));
 }
 protected override bool Equals(ValueOf <string, TThis> other)
 {
     return(EqualityComparer <string> .Default.Equals(this.Value.ToLowerInvariant(), other.Value.ToLowerInvariant()));
 }