How to let try-catch works in LINQPad

edited January 30
I'm trying to try-catch the folowing code in LINQPad. But LINQPad always stopped on Line 3. Can I just leave try-catch works as expected?

try
{
    headers.GetValues("User-Agent");
}
catch (IndexOutOfRangeException)
{
    headers.Remove("User-Agent");
    headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/7.0)");
}

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!