Powershell 2.0尝试捕获如何访问异常
这是try catchPowerShell 2.0中的 $urls = "http://www.google.com", "http://none.greenjump.nl", "http://www.nu.nl" $wc = New-Object System.Net.WebClient foreach($url in $urls) { try { $url $result=$wc.DownloadString($url) } catch [System.Net.WebException] { [void]$fails.Add("url webfailed $url") } } 但是我想做的是C# catch( WebException ex) { Log(ex.ToString()); } 这可能吗?