Closed CreateAndInject closed 3 years ago
IMO the best solution is to remove this method as implementing it efficiently is not so easy. For instance string.Concat(IEnumerable) presents only since .NET 4.0 and using string.Concat(string[]) means allocating a new array and copying the older one. If you look in the string.Concat implementation it has various optimization techniques: https://source.dot.net/#System.Private.CoreLib/String.Manipulation.cs,193
The simplest way for now is to use StringBuilder.
https://github.com/theraot/Theraot/blob/c67d4fb1aba7c1029a793964fee110a8b2e6801f/Framework.Core/Theraot/Core/StringHelper.cs#L22-L25
string result = "a".Append("b", "c", "d", "e"); // result: "aSystem.String[]"