Jump to content

Rosetta Code/Count examples: Difference between revisions

→‎{{header|C sharp|C#}}: Added some error handling and URL Encode the task page name so it can handle e.g. A+B
m (/mw/ => /w/)
(→‎{{header|C sharp|C#}}: Added some error handling and URL Encode the task page name so it can handle e.g. A+B)
Line 402:
 
foreach (string task in tasknames) {
stringtry content = GetSourceCodeFromPage(task, wc);{
string content = GetSourceCodeFromPage(WebUtility.UrlEncode(task), wc);
int count = new Regex("=={{header", RegexOptions.IgnoreCase).Matches(content).Count;
Task t int count = new TaskRegex(task"=={{header", countRegexOptions.IgnoreCase).Matches(content).Count;
Task t = new Task(task, count);
 
Console.WriteLine(t);
tasks.Add(t);
}
catch (Exception ex) {
Console.WriteLine("**** Unable to get task \"" + task + "\": " + ex.Message);
}
}
 
3,045

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.