/// <summary>
        /// Converts the string representation of a <see cref="CircleD"/> to an object instance.
        /// A return value indicates whether the conversion succeeded.
        /// </summary>
        /// <param name="s">The string to convert.</param>
        /// <param name="style">A set of <see cref="NumberStyles"/> values indicating which elements are present in <paramref name="s"/>.</param>
        /// <param name="provider">A format provider that provides culture-specific formatting information.</param>
        /// <param name="v">The converted value.</param>
        /// <returns><see langword="true"/> if the conversion succeeded; otherwise, <see langword="false"/>.</returns>
        public static Boolean TryParse(String s, NumberStyles style, IFormatProvider provider, out CircleD v)
        {
            v = default(CircleD);

            if (String.IsNullOrEmpty(s))
            {
                return(false);
            }

            var components = s.Split((Char[])null, StringSplitOptions.RemoveEmptyEntries);

            if (components.Length != 3)
            {
                return(false);
            }

            if (!Single.TryParse(components[0], style, provider, out Single x))
            {
                return(false);
            }
            if (!Single.TryParse(components[1], style, provider, out Single y))
            {
                return(false);
            }
            if (!Single.TryParse(components[2], style, provider, out Single radius))
            {
                return(false);
            }

            v = new CircleD(x, y, radius);
            return(true);
        }
Example #2
0
 /// <inheritdoc/>
 public Boolean Equals(CircleD other)
 {
     return
         (this.X == other.X &&
          this.Y == other.Y &&
          this.Radius == other.Radius);
 }
 /// <summary>
 /// Converts the string representation of a <see cref="CircleD"/> to an object instance.
 /// A return value indicates whether the conversion succeeded.
 /// </summary>
 /// <param name="s">The string to convert.</param>
 /// <param name="v">The converted value.</param>
 /// <returns><see langword="true"/> if the conversion succeeded; otherwise, <see langword="false"/>.</returns>
 public static Boolean TryParse(String s, out CircleD v)
 {
     return(TryParse(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo, out v));
 }