In answer to your second question, namely
maajanes wrote:
I have to count the number of occurances of a particular character. What can i do?
The fastest pattern I have come across
0 is
string source = "this is my test string";
char requiredCharacter = 's';
int count = 0;
foreach (char c in source)
{
if (c == requiredCharacter)
{
count++;
}
}
0
Can't remember were the original came from as it was a while ago, but it is what I use now