diff --git a/GBase/Helpers/Enumerables.cs b/GBase/Helpers/Enumerables.cs new file mode 100644 index 0000000..097eb1a --- /dev/null +++ b/GBase/Helpers/Enumerables.cs @@ -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 + { + /// + /// Convert an to a GBase + /// + /// The + /// + 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(); + } + } +} \ No newline at end of file