i tried already but still got error...because i wan to use in the foreach loop like
foreach(string a in sb.toString()) but this always give me the "Cannot convert Char type to String".What should i do..?
Since you have a character array, the first part of your foreach loop has to state Char, not string foreach(char a in sb.ToString()) There is only one string in a StringBuilder. foreach is for use with collections (IEnumerable) not single values.
still cannot...thanks for helping. Because now i want to find value for the sb.ToString().Trim().
Output for sb.ToString().Trim() is like this
This the key.
Now i wan to get their values.
foreach (char sort in sb.ToString().Trim())
int Count = (int)sortList[sort];
sortList[sort] = Count + 1;
The coding above is what i used to do to get the value for each key. My problem is the sb.ToString().Trim() cannot read in the foreach loop because it need array type. Now i need to use create one sortedList before i do in this foreach loop. I have no idea to do that. Who can help...?