Table of Contents

Class TableView

Namespace
ConsoleAppVisuals.PassiveElements
Assembly
ConsoleAppVisuals.dll

The TableView is a passive element that displays a table on the console.

public class TableView : PassiveElement
Inheritance
TableView
Inherited Members

Remarks

For more information, consider visiting the documentation available here.

Constructors

TableView(string?, List<string>?, List<List<string>>?, Placement, BordersType)

The TableView is a passive element that displays a table on the console.

public TableView(string? title = null, List<string>? headers = null, List<List<string>>? lines = null, Placement placement = Placement.TopCenter, BordersType bordersType = BordersType.SingleStraight)

Parameters

title string

The title of the table.

headers List<string>

The headers of the table.

lines List<List<string>>

The lines of the table.

placement Placement

The placement of the table.

bordersType BordersType

The type of borders to use for the table.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentException

Is thrown when the number of columns in the table is not consistent with itself or with the headers.

NullReferenceException

Is thrown when no body lines were provided.

Properties

Borders

Gets the borders of the table.

public Borders Borders { get; }

Property Value

Borders

BordersType

Gets the border type of the selector.

public BordersType BordersType { get; }

Property Value

BordersType

Count

Gets the number of lines in the table.

public int Count { get; }

Property Value

int

GetRawHeaders

Gets the headers of the table.

public List<string>? GetRawHeaders { get; }

Property Value

List<string>

GetRawLines

Gets the lines of the table.

public List<List<string>>? GetRawLines { get; }

Property Value

List<List<string>>

Height

Gets the height of the table.

public override int Height { get; }

Property Value

int

Placement

Gets the title of the table.

public override Placement Placement { get; }

Property Value

Placement

Width

Gets the width of the table.

public override int Width { get; }

Property Value

int

Methods

AddHeaders(List<string>)

Adds headers to the table.

public void AddHeaders(List<string> headers)

Parameters

headers List<string>

The headers to add.

Remarks

For more information, consider visiting the documentation available here.

AddLine(List<string>)

Adds a line to the table.

public void AddLine(List<string> line)

Parameters

line List<string>

The line to add.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentException

Is thrown when the number of columns in the table is not consistent with itself or with the headers.

AddTitle(string)

Adds a title to the table.

public void AddTitle(string title)

Parameters

title string

The title to add.

Remarks

For more information, consider visiting the documentation available here.

ClearHeaders()

Clears the headers of the table.

public void ClearHeaders()

Remarks

For more information, consider visiting the documentation available here.

ClearLines()

Clears the lines of the table.

public void ClearLines()

Remarks

For more information, consider visiting the documentation available here.

ClearTitle()

Clears the title of the table.

public void ClearTitle()

Remarks

For more information, consider visiting the documentation available here.

GetColumnData(int)

Gets all the elements from a column given its index.

public List<string>? GetColumnData(int index)

Parameters

index int

The index of the column.

Returns

List<string>

The elements of the column.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Is thrown when the index is out of range.

GetColumnData(string)

Gets all the elements from a column given its header.

public List<string>? GetColumnData(string header)

Parameters

header string

The header of the column.

Returns

List<string>

The elements of the column.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

InvalidOperationException

Is thrown when the table is empty.

ArgumentOutOfRangeException

Is thrown when the header is invalid.

GetLine(int)

Gets the specified line in the table.

public List<string> GetLine(int index)

Parameters

index int

The index of the line to return.

Returns

List<string>

The line at the specified index.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Is thrown when the index is out of range.

RemoveLine(int)

Removes a line from the table.

public void RemoveLine(int index)

Parameters

index int

The index of the line to remove.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Is 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()

Reset()

Clears the table.

public void Reset()

Remarks

For more information, consider visiting the documentation available here.

UpdateBordersType(BordersType)

Updates the borders of the table.

public void UpdateBordersType(BordersType bordersType)

Parameters

bordersType BordersType

The type of border to use for the table.

Remarks

For more information, consider visiting the documentation available here.

UpdateHeaders(List<string>)

Updates the headers of the table.

public void UpdateHeaders(List<string> headers)

Parameters

headers List<string>

The headers to update.

Remarks

For more information, consider visiting the documentation available here.

UpdateLine(int, List<string>)

Updates a line in the table.

public void UpdateLine(int index, List<string> line)

Parameters

index int

The index of the line to update.

line List<string>

The new line.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

Is thrown when the index is out of range.

ArgumentException

Is thrown when the number of columns in the table is not consistent with itself or with the headers.

UpdatePlacement(Placement)

Updates the placement of the table.

public void UpdatePlacement(Placement placement)

Parameters

placement Placement

The new placement of the table.

Remarks

For more information, consider visiting the documentation available here.

UpdateTitle(string)

Updates the title of the table.

public void UpdateTitle(string title)

Parameters

title string

The title to update.

Remarks

For more information, consider visiting the documentation available here.