/// <summary> /// Converts the string representation of a <see cref="Size2F"/> 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 Size2F v) { v = default(Size2F); if (String.IsNullOrEmpty(s)) { return(false); } var components = s.Split((Char[])null, StringSplitOptions.RemoveEmptyEntries); if (components.Length != 2) { return(false); } Single width, height; if (!Single.TryParse(components[0], style, provider, out width)) { return(false); } if (!Single.TryParse(components[1], style, provider, out height)) { return(false); } v = new Size2F(width, height); return(true); }
/// <summary> /// Converts the string representation of a <see cref="Size2F"/> 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 Size2F v) { return(TryParse(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo, out v)); }
/// <summary> /// Initializes a new instance of the <see cref="RectangleF"/> class. /// </summary> /// <param name="position">The rectangle's position.</param> /// <param name="size">The rectangle's size.</param> public RectangleF(Point2F position, Size2F size) : this(position.X, position.Y, size.Width, size.Height) { }
/// <summary> /// Initializes a new instance of the <see cref="RectangleF"/> structure. /// </summary> /// <param name="position">The position of the rectangle's top-left corner.</param> /// <param name="size">The area of the rectangle.</param> public RectangleF(Vector2 position, Size2F size) : this(position.X, position.Y, size.Width, size.Height) { }
/// <inheritdoc/> public Boolean Equals(Size2F other) { return (this.Width == other.Width && this.Height == other.Height); }