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

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

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

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