, :
int total = 0;
foreach (char c in theString) {
if (c == '-') total++;
}
, :
int total = theString.Count(c => c == '-');
:
int total = theString.Aggregate(0, (t,c) => c == '-' ? t + 1 : t)
( ) , :
int total = theString.Length - theString.Replace("-", String.Empty).Length;
:
int total = Regex.Matches(theString, "-").Count;