Table of Contents

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)

Initializes a new instance of the Position class with another instance of the Position class.

public Position(Position pos)

Parameters

pos Position

The 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

x int

The x coordinate of the position.

y int

The y coordinate of the position.

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

int

Y

Gets the y coordinate of the position.

public int Y { readonly get; set; }

Property Value

int

Methods

Equals(object?)

Compares the position to another position.

public override readonly bool Equals(object? obj)

Parameters

obj object

The 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

left Position

The first position to compare.

right Position

The second position to compare.

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

left Position

The first position to compare.

right Position

The second position to compare.

Returns

bool

True if the positions are not equal, false otherwise.