Initial commit

Initial commit til Git.
V2 er deployed
This commit is contained in:
2026-06-13 17:31:50 +02:00
parent 9fcd2b145e
commit 41e23b6184
375 changed files with 15956 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
namespace ESCPOS_NET.Extensions
{
public static class Util
{
/// <summary>
/// Adds to the list of T items and/or enumerables of T. All other types will be ignored and not added to the list.
/// </summary>
/// <typeparam name="T">List's items type.</typeparam>
/// <param name="list">List to be added the items.</param>
/// <param name="items">Items to be added.</param>
/// <returns>True if no item was ignored, otherwise False.</returns>
public static bool AddRange<T>(this List<T> list, params object[] items)
{
bool ignoredItems = false;
foreach (var item in items)
{
if (item is T itemT)
{
list.Add(itemT);
}
else if (item is IEnumerable<T> arrayT)
{
list.AddRange(arrayT);
}
else
{
ignoredItems = true;
}
}
return !ignoredItems;
}
}
}