I have a code that I want to count the number of appearing each letter in alphabet in the input string. I used a dictionary<char, int> to have a key for each letter and a value as the count of appearance. So, how to have a list of 'a' to 'z' to use as keys? I've tried this:
Dictionary<char, int> alphabetCounter = new Dictionary<char, int>();
for (char ch = 'a'; ch <= 'z'; ch++)
alphabetCounter[ch] = 0;
Is it a better way to have the list of 'a' to 'z'? Thank you.