Table of Contents

Class Matrix<T>

Namespace
ConsoleAppVisuals.PassiveElements
Assembly
ConsoleAppVisuals.dll

The Matrix<T> is a passive element that displays a matrix on the console.

public class Matrix<T> : PassiveElement

Type Parameters

T
Inheritance
Matrix<T>
Inherited Members

Remarks

For more information, consider visiting the documentation available here.

Constructors

Matrix(List<List<T?>>?, Placement, BordersType)

The Matrix<T> is a passive element that displays a matrix on the console.

public Matrix(List<List<T?>>? rawLines = null, Placement placement = Placement.TopCenter, BordersType bordersType = BordersType.SingleStraight)

Parameters

rawLines List<List<T>>

The matrix to be used.

placement Placement

The placement of the matrix.

bordersType BordersType

The type of borders to use for the matrix.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentException

Thrown when the matrix is empty or not compatible (lines are not of the same length).

Properties

Borders

The border characters to use for the matrix.

public Borders Borders { get; }

Property Value

Borders

BordersType

The border type of the selector.

public BordersType BordersType { get; }

Property Value

BordersType

Count

Gets the number of lines in the matrix.

public int Count { get; }

Property Value

int

Height

Gets the height of the matrix.

public override int Height { get; }

Property Value

int

Placement

Gets the placement of the matrix.

public override Placement Placement { get; }

Property Value

Placement

Width

Gets the width of the matrix.

public override int Width { get; }

Property Value

int

Methods

AddLine(List<T?>)

Adds a line to the matrix.

public bool AddLine(List<T?> line)

Parameters

line List<T>

The line to add.

Returns

bool

True if the line has been added successfully, false otherwise.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentException

Thrown when the line is not of the same length as the other lines.

GetItem(Position)

Gets the element at the specified position.

public T? GetItem(Position position)

Parameters

position Position

The position of the element.

Returns

T

The element at the specified position.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Thrown when the position is out of range.

InsertLine(int, List<T?>)

Inserts a line at the specified index.

public bool InsertLine(int index, List<T?> line)

Parameters

index int

The index of the line to insert.

line List<T>

The line to insert.

Returns

bool

True if the line has been inserted successfully, false otherwise.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Thrown when the index is out of range.

ArgumentException

Thrown when the line is not of the same length as the other lines.

RemoveItem(Position)

Removes an element from the matrix.

public bool RemoveItem(Position position)

Parameters

position Position

The position of the element to remove.

Returns

bool

True if the element has been removed successfully, false otherwise.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Thrown when the position is out of range.

RemoveLine(int)

Removes a line from the matrix.

public bool RemoveLine(int index)

Parameters

index int

The index of the line to remove.

Returns

bool

True if the line has been removed successfully, false otherwise.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Thrown when the index is out of range.

RenderElementActions()

Defines the actions to perform when the element is called to be rendered on the console.

[Visual]
protected override void RenderElementActions()

UpdateBordersType(BordersType)

Updates the borders of the matrix.

public void UpdateBordersType(BordersType bordersType)

Parameters

bordersType BordersType

The new border type of the matrix.

Remarks

For more information, consider visiting the documentation available here.

UpdateItem(Position, T)

Updates an element in the matrix.

public bool UpdateItem(Position position, T item)

Parameters

position Position

The position of the element to update.

item T

The new element.

Returns

bool

True if the element has been updated successfully, false otherwise.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Thrown when the position is out of range.

UpdateLine(int, List<T?>)

Updates a line in the matrix.

public bool UpdateLine(int index, List<T?> line)

Parameters

index int

The index of the line to update.

line List<T>

The new line.

Returns

bool

True if the line has been updated successfully, false otherwise.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Thrown when the index is out of range.

ArgumentException

Thrown when the line is not of the same length as the other lines.

UpdatePlacement(Placement)

Updates the placement of the matrix.

public void UpdatePlacement(Placement placement)

Parameters

placement Placement

The new placement of the matrix.

Remarks

For more information, consider visiting the documentation available here.