Struct Point2D
Represents Point2D.
public struct Point2D : IPoint2D, IComparable<Point2D>, IComparable<IPoint2D>, IEquatable<object>, IEquatable<Point2D>, IEquatable<IPoint2D>, ISpanFormattable, IFormattable, ISpanParsable<Point2D>, IParsable<Point2D>
- Implements
- Inherited Members
Constructors
Point2D(Point2D)
public Point2D(Point2D p)
Parameters
pPoint2D
Point2D(Point3D)
public Point2D(Point3D p)
Parameters
pPoint3D
Point2D(IPoint2D)
public Point2D(IPoint2D p)
Parameters
pIPoint2D
Point2D(int, int)
public Point2D(int x, int y)
Parameters
Fields
Zero
public static readonly Point2D Zero
Field Value
Properties
X
Gets the X coordinate.
public int X { readonly get; set; }
Property Value
Y
Gets the Y coordinate.
public int Y { readonly get; set; }
Property Value
Methods
CompareTo(Point2D)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(Point2D other)
Parameters
otherPoint2DAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
CompareTo(IPoint2D)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(IPoint2D other)
Parameters
otherIPoint2DAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Equals(Point2D)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Point2D other)
Parameters
otherPoint2DAn object to compare with this object.
Returns
Equals(IPoint2D)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(IPoint2D other)
Parameters
otherIPoint2DAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Parse(ReadOnlySpan<char>, IFormatProvider)
Parses a span of characters into a value.
public static Point2D Parse(ReadOnlySpan<char> s, IFormatProvider provider)
Parameters
sReadOnlySpan<char>The span of characters to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.
Returns
- Point2D
The result of parsing
s.
Exceptions
- FormatException
sis not in the correct format.- OverflowException
sis not representable by Point2D.
Parse(string)
public static Point2D Parse(string s)
Parameters
sstring
Returns
Parse(string, IFormatProvider)
Parses a string into a value.
public static Point2D Parse(string s, IFormatProvider provider)
Parameters
sstringThe string to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.
Returns
- Point2D
The result of parsing
s.
Exceptions
- ArgumentNullException
sis null.- FormatException
sis not in the correct format.- OverflowException
sis not representable by Point2D.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToString(string, IFormatProvider)
Formats the value of the current instance using the specified format.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider)
Tries to format the value of the current instance into the provided span of characters.
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)
Parameters
destinationSpan<char>The span in which to write this instance's value formatted as a span of characters.
charsWrittenintWhen this method returns, contains the number of characters that were written in
destination.formatReadOnlySpan<char>A span containing the characters that represent a standard or custom format string that defines the acceptable format for
destination.providerIFormatProviderAn optional object that supplies culture-specific formatting information for
destination.
Returns
TryParse(ReadOnlySpan<char>, IFormatProvider, out Point2D)
Tries to parse a span of characters into a value.
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider provider, out Point2D result)
Parameters
sReadOnlySpan<char>The span of characters to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.resultPoint2DWhen this method returns, contains the result of successfully parsing
s, or an undefined value on failure.
Returns
TryParse(string, IFormatProvider, out Point2D)
Tries to parse a string into a value.
public static bool TryParse(string s, IFormatProvider provider, out Point2D result)
Parameters
sstringThe string to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
s.resultPoint2DWhen this method returns, contains the result of successfully parsing
sor an undefined value on failure.
Returns
Operators
operator ==(Point2D, Point2D)
public static bool operator ==(Point2D l, Point2D r)
Parameters
Returns
operator ==(Point2D, IPoint2D)
public static bool operator ==(Point2D l, IPoint2D r)
Parameters
Returns
operator >(Point2D, Point2D)
public static bool operator >(Point2D l, Point2D r)
Parameters
Returns
operator >(Point2D, IPoint2D)
public static bool operator >(Point2D l, IPoint2D r)
Parameters
Returns
operator >=(Point2D, Point2D)
public static bool operator >=(Point2D l, Point2D r)
Parameters
Returns
operator >=(Point2D, IPoint2D)
public static bool operator >=(Point2D l, IPoint2D r)
Parameters
Returns
operator !=(Point2D, Point2D)
public static bool operator !=(Point2D l, Point2D r)
Parameters
Returns
operator !=(Point2D, IPoint2D)
public static bool operator !=(Point2D l, IPoint2D r)
Parameters
Returns
operator <(Point2D, Point2D)
public static bool operator <(Point2D l, Point2D r)
Parameters
Returns
operator <(Point2D, IPoint2D)
public static bool operator <(Point2D l, IPoint2D r)
Parameters
Returns
operator <=(Point2D, Point2D)
public static bool operator <=(Point2D l, Point2D r)
Parameters
Returns
operator <=(Point2D, IPoint2D)
public static bool operator <=(Point2D l, IPoint2D r)