Create An X Delimited String From A Char List Using Linq Aggregate

A quick example of how to use the Aggregate method to create a string of delimited members, or in this case characters. You might wonder why this example, or at least you should. It’s true, the character list to delimited string is pretty useless, but some idiot from where I work needed it.

public void GetStringFromCharacters()
    var charList = Enumerable.Range(0, 10).Select(x => 'a').ToList();

        .Aggregate("", (inner, outer) => inner + outer.ToString() + ",")

The big thing here is the “” in the Aggregate method signature. That basically says that Inner is a string. If I didn’t have that specified, both inner and outer would be a character.