private static int CountChars(MyLine line) { int numberOfChars = 0; for (int i = 0; i < line.MyPassword.Length; i++) { if (line.MyPassword[i] == line.MyChar) { numberOfChars++; } } return(numberOfChars); }