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)); }
public bool Equals(LengthPerUnitlessUnit other) { return(this.symbol == other.symbol); }
public static bool TryParse(string text, out LengthPerUnitlessUnit result) { return(UnitParser <LengthPerUnitlessUnit> .TryParse(text, out result)); }