I wanna find the count of each character in a row in a given string. For example "aabaccbb" has two 'a', one 'b', one 'a', two 'c', and two 'b'.
I wanna have a collection of <char,int> pairs and the order is important for me. For example above like this: { {'a', 2}, {'b', 1}, {'a', 1}, {'c', 2}, {'b', 2} }
So what can I do?
I think you just want to make a class to hold the values for you and then make a list of that type
public class CharCount
{
public char Char { get; set; }
public int Count { get; set; }
}
then just create your list of that type
new List<CharCount>()