Using StringBuilder performance for O (n):
split .Take(split.Length - 1) .Aggregate(new StringBuilder(), (sb, s) => sb.Append(s)).ToString();
If an object should avoid the awkwardness of the tree of combined LINQ calls and static methods, then an extension method is a simple solution:
public static string Join(this IEnumerable<string> self, string separator = "") { return string.Join(separator, self); }
And then:
split.Take(split.Length - 1).Join();
I believe this is much better than using string.Join in complex expressions.
source share