mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-27 00:08:02 +01:00
32 lines
851 B
C#
32 lines
851 B
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace Spectre.Console
|
|
{
|
|
/// <summary>
|
|
/// Contains extension methods for <see cref="Grid"/>.
|
|
/// </summary>
|
|
public static class GridExtensions
|
|
{
|
|
/// <summary>
|
|
/// Adds a new row to the grid.
|
|
/// </summary>
|
|
/// <param name="grid">The grid to add the row to.</param>
|
|
/// <param name="columns">The columns to add.</param>
|
|
public static void AddRow(this Grid grid, params string[] columns)
|
|
{
|
|
if (grid is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(grid));
|
|
}
|
|
|
|
if (columns is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(columns));
|
|
}
|
|
|
|
grid.AddRow(columns.Select(column => new Markup(column)).ToArray());
|
|
}
|
|
}
|
|
}
|