public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var text = value as string;

            if (text != null)
            {
                LengthPerUnitlessUnit result;
                if (LengthPerUnitlessUnit.TryParse(text, out result))
                {
                    return(result);
                }

                var message = $"Could not convert the string '{text}' to an instance of LengthPerUnitlessUnit)";
                throw new NotSupportedException(message);
            }

            return(base.ConvertFrom(context, culture, value));
        }
Exemple #2
0
 public bool Equals(LengthPerUnitlessUnit other)
 {
     return(this.symbol == other.symbol);
 }
Exemple #3
0
 public static bool TryParse(string text, out LengthPerUnitlessUnit result)
 {
     return(UnitParser <LengthPerUnitlessUnit> .TryParse(text, out result));
 }