From 843b0543fa247741c089284eec1879df05107b75 Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Thu, 21 Oct 2021 11:08:40 +0200
Subject: [PATCH] Added new extension method for joining an Enumerable<T> with
 string.Join

---
 .../VectoCommon/Utils/EnumerableExtensionMethods.cs      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs
index 20e6d1aabb..f775e7a2f0 100644
--- a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs
+++ b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs
@@ -39,6 +39,9 @@ namespace TUGraz.VectoCommon.Utils
 {
 	public static class EnumerableExtensionMethods
 	{
+		public static string Join<T>(this IEnumerable<T> list, string separator = ", ") =>
+			string.Join(separator, list ?? Enumerable.Empty<T>());
+
 		public static IEnumerable<(T value, int index)> Select<T>(this IEnumerable<T> self) =>
 			self.Select((value, index) => (value, index));
 
@@ -156,16 +159,16 @@ namespace TUGraz.VectoCommon.Utils
 			}
 		}
 
-		public static T Sum<T>(this IEnumerable<T> values) where T : SIBase<T> => 
+		public static T Sum<T>(this IEnumerable<T> values) where T : SIBase<T> =>
 			values.Sum(x => x);
 
 		public static TResult Sum<TU, TResult>(this IEnumerable<TU> values, Func<TU, TResult> selector)
 			where TResult : SIBase<TResult> =>
 			values.Select(selector).DefaultIfEmpty().Aggregate((sum, current) => sum + current);
 
-		public static T Average<T>(this IEnumerable<T> values) where T : SIBase<T> => 
+		public static T Average<T>(this IEnumerable<T> values) where T : SIBase<T> =>
 			values.Average(v => v.Value()).SI<T>();
-		
+
 		/// <summary>
 		/// Get the first two items where the predicate changes from true to false.
 		/// If the predicate is always true, the last 2 elements are returned.
-- 
GitLab