// Create a list of names
// Print names that begin with a certain letter of your choosing
// Extra Challenge:
// Create a list of name in last, first format
// Print names where first name begins with a certain letter of your choosing
using System;
using System.Collections.Generic;
var superheroes =
new []
{
"Kent, Clark",
"Prince, Diana",
"Wayne, Bruce",
"Gordon, Barry",
"Grayson, Dick",
"West, Adam",
"Reeves, Christopher",
"Keaton, Michael",
"Ward, Burt"
};
IEnumerable<string> GetStringsStartingWithCharacter(IEnumerable<string
var matches = new List<string>();
foreach(var n in names)
if(n.StartsWith(c))
matches.Add(n);
}
return matches;
foreach(var n in GetStringsStartingWithCharacter(superheroes, "C"))
Console.WriteLine ();