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
stringThe title of the table.
headers
List<string>The headers of the table.
lines
List<List<string>>The lines of the table.
placement
PlacementThe placement of the table.
bordersType
BordersTypeThe 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
BordersType
Gets the border type of the selector.
public BordersType BordersType { get; }
Property Value
Count
Gets the number of lines in the table.
public int Count { get; }
Property Value
GetRawHeaders
Gets the headers of the table.
public List<string>? GetRawHeaders { get; }
Property Value
GetRawLines
Gets the lines of the table.
public List<List<string>>? GetRawLines { get; }
Property Value
Height
Gets the height of the table.
public override int Height { get; }
Property Value
Placement
Gets the title of the table.
public override Placement Placement { get; }
Property Value
Width
Gets the width of the table.
public override int Width { get; }
Property Value
Methods
AddHeaders(List<string>)
Adds headers to the table.
public void AddHeaders(List<string> headers)
Parameters
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
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
stringThe 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
intThe index of the column.
Returns
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
stringThe header of the column.
Returns
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
intThe index of the line to return.
Returns
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
intThe 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
BordersTypeThe 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
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
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
PlacementThe 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
stringThe title to update.
Remarks
For more information, consider visiting the documentation available here.