|
|
|
|
@ -0,0 +1,32 @@ |
|
|
|
|
// 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(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |