Created
April 23, 2020 10:08
-
-
Save filipnavara/b1a13014d10ca280259a90f75eb4babc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class C | |
{ | |
public static bool ThirdPartyBuggyFunction(string randomParameter) | |
{ | |
try | |
{ | |
return randomParameter[0] == '/'; | |
} | |
catch (Exception e) | |
{ | |
} | |
return true; | |
} | |
public static void M() | |
{ | |
bool observedException = true; | |
try | |
{ | |
} | |
catch (Exception e) when (ObserveException(e)) | |
{ | |
} | |
Console.WriteLine("Observed exception: " + observedException); | |
bool ObserveException(Exception e) | |
{ | |
observedException = true; | |
return false; | |
} | |
} | |
public static void Main() | |
{ | |
M(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment