Use String.Join for concatenation

Changfeng Tan
Sep 13, 2021

Encounter this during work in Napier and it is worth to mark it down. People may in favor of using LINQ aggregate method over List<string> but result in performance issue especially when the list is large.

Use String.Join(“, ”, stringArr) instead will do the trick instead of stringArr.Aggregate( (current, next) => current + “, ” + next) since it is not using a string builder.

--

--