mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Clean up table rendering a bit
This commit is contained in:
committed by
Patrik Svensson
parent
c6210f75ca
commit
179e243214
@@ -6,6 +6,23 @@ namespace Spectre.Console.Internal
|
||||
{
|
||||
internal static class EnumerableExtensions
|
||||
{
|
||||
public static int IndexOf<T>(this IEnumerable<T> source, T item)
|
||||
where T : class
|
||||
{
|
||||
var index = 0;
|
||||
foreach (var candidate in source)
|
||||
{
|
||||
if (candidate == item)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int GetCount<T>(this IEnumerable<T> source)
|
||||
{
|
||||
if (source is IList<T> list)
|
||||
|
||||
Reference in New Issue
Block a user