Quickest way to enumerate the alphabet
Solution 1:
(Assumes ASCII, etc)
for (char c = 'A'; c <= 'Z'; c++)
{
//do something with letter
}
Alternatively, you could split it out to a provider and use an iterator (if you're planning on supporting internationalisation):
public class EnglishAlphabetProvider : IAlphabetProvider
{
public IEnumerable<char> GetAlphabet()
{
for (char c = 'A'; c <= 'Z'; c++)
{
yield return c;
}
}
}
IAlphabetProvider provider = new EnglishAlphabetProvider();
foreach (char c in provider.GetAlphabet())
{
//do something with letter
}
Solution 2:
Or you could do,
string alphabet = "abcdefghijklmnopqrstuvwxyz";
foreach(char c in alphabet)
{
//do something with letter
}