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

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

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

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