Counting the number of character occurrences
You could do the same thing with LINQ:

var counts = longText.GroupBy(c =&gt; c) // put each character into a "bucket"
                     // order the buckets alphabetically
                     .OrderBy(c =&gt; c.Key);
                     // then convert to dictionary where key = character, value = count
                     .ToDictionary(grp =&gt; grp.Key, grp =&gt; grp.Count()) 


For convenience/readability, you could turn this into an extension method on string:

static class Extensions 
{
    public static Dictionary&lt;char, int&gt; CharacterCount(this string text)
    {
        return text.GroupBy(c =&gt; c)
                   .OrderBy(c =&gt; c.Key)
                   .ToDictionary(grp =&gt; grp.Key, grp =&gt; grp.Count());
    }
}


And invoke it like this:

var longText = @"The quick brown fox jumps over the lazy dog";

var counts = longText.CharacterCount();


However, note that the above doesn't produce a sorted dictionary in the sense that if you were to add another key/value to it afterwards, the order would no longer be maintained. You could re-sort at that point, or use this SortedDictionary constructor to create a sorted dictionary.