Uppercase the initial char of every string in a list
Start by writing a method that returns the initials of a single string.

private static string GetInitials(string name)
{
    ???
}


You have the right idea, but there are some overloads we can use that will make the code a bit nicer:

private static string GetInitials(string name)
{
    var initials = name
        .Split((char[])null, StringSplitOptions.RemoveEmptyEntries)
        .Select(w =&gt; char.ToUpper(w[0]));
    return new string(initials.ToArray());
}


Here we've used the overload of Split that won't return empty entries, so we don't have to check for empty entries. We've also used the string(char[]) constructor instead of building up the string ourselves.

Now Initials we be written as

return names.Select(GetInitials);




There's a problem with both versions in that the method will not return if the input sequence is infinite (which you've mentioned is a case you want to handle).

Suppose we have this helper method to create an infinite sequence of a single value

private static IEnumerable&lt;T&gt; Repeat&lt;T&gt;(T value)
{
    while (true)
    {
        yield return value;
    }
}


Then our method should be able to handle this client code:

foreach (var cl in Repeat("Mickey Mouse").Initials().Take(5))
{
    Console.WriteLine(cl);
}


The versions posted must process every element of the sequence before they return, which isn't possible for infinite sequences.