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

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

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

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