News for hackers. Stuff that matters.
Re:Programming languages: This old favourite is gaining popu... by to11mtm on Tuesday December 07, 2021 @02:08PM (#29476833)
> Does anyone know why this form is not used?

Likely because early versions of C# (Pre-generics) wouldn't have had a good way to specifically offer a .Join method on string arrays specifically.

Now that we have generics, .Join() on an array normally refers to a type of Linq operation where you join two sequences together. You actually probably could make an extension method for your own usage in-app that would give you this functionality; if I had to guess why they didn't, I would assume it would consume Linq users.

OTOH that's kinda the nice thing about C# though. It's easy to go:

    public static class StringArrayExtensions
    {
        public static string Join(this string[] arr, string joinToken)
        {
           return string.Join(joinToken, arr);
        }
    }
and package such utility functions into a shared lib for your team to use.

There are no comments on this comment yet.