Skip to content

string.Join() with alternative joins for last #1

@colinangusmackay

Description

@colinangusmackay
var array = new string[]{"abc", "def", "ghi"};
var listString = string.Join(", ", array);
// Produces:
// abc, def, ghi

But, what if want the last join to be ", and " instead of just ", " like the rest? So that the output is:

abc, def, and ghi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions