I have a List containing a bunch of strings that can occur more than once. I would like to take this list and build a dictionary of the list items as the key and the count
I would have made a specialized List, that backed by the Dictionary and the add method would test for membership and increase count if found.
sorta like:
public class CountingList
{
Dictionary countingList = new Dictionary();
void Add( string s )
{
if( countingList.ContainsKey( s ))
countingList[ s ] ++;
else
countingList.Add( s, 1 );
}
}