Note that this will not work as intended if the substrings "overlap" each other.
So this example would need another solution: How many times does "bob" appear in "bobobob"?
This particular way of doing it works looks like this:
int count = ( string.Length - string.Replace(substring, string.empty).Length ) / substring.Length;
Basically we count how many times we can remove the substring from the string...
This solution came from here:
http://oldschooldotnet.blogspot.se/2008/12/c-counting-number-of-occurrences-of.html