You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
895 B
32 lines
895 B
// Author: Gockner, Simon
|
|
// Created: 2020-02-13
|
|
// Copyright(c) 2020 SimonG. All Rights Reserved.
|
|
|
|
using System.Collections;
|
|
using System.Text;
|
|
|
|
namespace GBase.Helpers
|
|
{
|
|
internal static class Enumerables
|
|
{
|
|
/// <summary>
|
|
/// Convert an <see cref="IEnumerable"/> to a GBase <see cref="string"/>
|
|
/// </summary>
|
|
/// <param name="enumerable">The <see cref="IEnumerable"/></param>
|
|
/// <returns></returns>
|
|
public static string ToGBaseString(this IEnumerable enumerable)
|
|
{
|
|
StringBuilder @string = new StringBuilder();
|
|
foreach (var item in enumerable)
|
|
{
|
|
@string.Append($"{item},");
|
|
}
|
|
|
|
char lastChar = @string[^1];
|
|
if (lastChar == ',')
|
|
@string.Remove(@string.Length - 1, 1);
|
|
|
|
return @string.ToString();
|
|
}
|
|
}
|
|
} |