Quote:
Originally Posted by BeneathTheStars
Got it to do as i want.. thanks very much mordero, Sep102, Jeff, and Nochte!
Here it is:
Code:
private void CountTypes()
{
Dictionary<string, int> types = new Dictionary<string, int>();
foreach (string s in m_types)
{
if (!types.ContainsKey(s))
types.Add(s, 1);
else
types[s] += 1;
}
foreach (string filetype in types.Keys)
{
if (types[filetype] == 1)
continue;
SetText4(filetype + " " + types[filetype] + "\r\n");
}
}
Once i get the whole thing done, i will post it!
|
So, from what I understand from this method, you want to go through all of the types, find each unique type and count how many times it appeared in the original array, then call SetText4 for any type that appeared more than once in the original array (at least, that's what the if(types[filetype] == 1) check will do, make it skip any types that appeared only once). You would need to get rid of that if you wanted to do what the original code was supposed to have been doing, calling SetText4 for every type.