I’m new to ASP.NET C#. Trying to create an ArrayList with 2 columns one for the value (string) and one for counting how many of each. While adding values I need to search the ArrayList to find if the value already exist, if so add 1, if not, add it to the array and set count column to 1. Can someone provide a bit of code sample? If there is a better approach then I’d like to hear it.
Share
If you’re just starting with a list of strings, there are plenty of simpler ways to do this.
I’d probably use the
GroupByextension hereThen putting into an ArrayList, if you want:
But I’d probably prefer to put this into a
Dictionary, because you know that each word will map to just one value – the number of times it appears.