c# counting identical strings from text file
- by Winkz
I have a foreach statement where I go through several lines from a text file, where I have trimmed down and sorted out the lines I need. What I want to do is count up on how many times an identical string is present.  How do I do this?
Here is my code. It's the second if statement where I am stuck:
        foreach (string line in lines.Where(l => l.Length >= 5))
        {
            string a = line.Remove(0, 11);
            if ((a.Contains(mobName) && a.Contains("dies")))
            {
                mobDeathCount++;
            }
            if (a.Contains(mobName) && a.Contains("drops"))
            {
                string lastpart = a.Substring(a.LastIndexOf("drops"));
                string modifiedLastpart = lastpart.Remove(0, 6);
            }
Heres what some of the lines look like:
a bag of coins
a siog brandy
a bag of coins
a bag of coins
the Cath Shield
a tattered scroll
So what im trying to do is counting up there are 3 lines with bag of coins. But i need to make it so that it can be everything, theres a drop lists thats huge. So cant add all of em, would take too long