Also ich würde das vermutlich eher so schreiben:
Code:
string filtered = String.Empty;
bool escape = false;
bool instring = false;
foreach (char current in PageContent[i])
{
if (escape && instring)
{
filtered += current;
}
else
{
escape = (current == '\\');
if (escape)
continue;
if (current == '(')
instring = true;
else if (current == ')')
instring = false;
}
}