Struct Position
- Namespace
- ConsoleAppVisuals.Models
- Assembly
- ConsoleAppVisuals.dll
The Position
struct represents a position in the console with a line and a column.
public struct Position : IEquatable<Position>
- Implements
- Inherited Members
Remarks
For more information, consider visiting the documentation available here.
Constructors
Position(Position)
public Position(Position pos)
Parameters
pos
PositionThe position to copy.
Remarks
For more information, consider visiting the documentation available here.
Position(int, int)
Initializes a new instance of the Position class with 2 coordinates.
public Position(int x, int y)
Parameters
Remarks
For more information, consider visiting the documentation available here.
Properties
X
Gets the x coordinate of the position.
public int X { readonly get; set; }
Property Value
Y
Gets the y coordinate of the position.
public int Y { readonly get; set; }
Property Value
Methods
Equals(object?)
Compares the position to another position.
public override readonly bool Equals(object? obj)
Parameters
obj
objectThe position to compare to.
Returns
- bool
True if the positions are equal, false otherwise.
Remarks
For more information, consider visiting the documentation available here.
GetHashCode()
Gets the hash code of the position.
public override readonly int GetHashCode()
Returns
- int
An integer representing the hash code of the position.
Remarks
For more information, consider visiting the documentation available here.
ToString()
Converts the position to a string.
public override readonly string ToString()
Returns
- string
The position as a string.
Remarks
For more information, consider visiting the documentation available here.
Operators
operator ==(Position, Position)
Implements the operator to check if the position is equal to another position.
public static bool operator ==(Position left, Position right)
Parameters
Returns
- bool
True if the positions are equal, false otherwise.
operator !=(Position, Position)
Implements the operator to check if the position is not equal to another position.
public static bool operator !=(Position left, Position right)
Parameters
Returns
- bool
True if the positions are not equal, false otherwise.