/// <devdoc>
        /// <para>Converts the given object to a <see cref='Gu.Units.AmountOfSubstanceUnit'/>
        /// object.</para>
        /// </devdoc>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var text = value as string;

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

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

            return(base.ConvertFrom(context, culture, value));
        }
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.AmountOfSubstanceUnit"/> object.
 /// </summary>
 /// <param name="other">An instance of <see cref="Gu.Units.AmountOfSubstanceUnit"/> object to compare with this instance.</param>
 /// <returns>
 /// true if <paramref name="other"/> represents the same AmountOfSubstanceUnit as this instance; otherwise, false.
 /// </returns>
 public bool Equals(AmountOfSubstanceUnit other)
 {
     return(this.symbol == other.symbol);
 }
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.AmountOfSubstanceUnit"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.AmountOfSubstanceUnit"/></param>
 /// <param name="result">The parsed <see cref="AmountOfSubstanceUnit"/></param>
 /// <returns>True if an instance of <see cref="AmountOfSubstanceUnit"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, out AmountOfSubstanceUnit result)
 {
     return(UnitParser <AmountOfSubstanceUnit> .TryParse(text, out result));
 }