[c#] Counting how many times a certain char appears in a string before any other char appears

just a simple answer:

    public static int CountChars(string myString, char myChar)
    {
        int count = 0;
        for (int i = 0; i < myString.Length; i++)
        {
            if (myString[i] == myChar) ++count;
        }
        return count;
    }

Cheers! - Rick