We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad300e3 commit 3dfe22eCopy full SHA for 3dfe22e
1 file changed
src/DocoptNet/Docopt.cs
@@ -211,14 +211,10 @@ public static IEnumerable<Pattern> GetFlatPatterns(string doc)
211
212
protected void OnPrintExit(string doc, int errorCode = 0)
213
{
214
- if (PrintExit == null)
215
- {
216
- throw new DocoptExitException(doc);
217
- }
+ if (PrintExit is { } handler)
+ handler(this, new PrintExitEventArgs(doc, errorCode));
218
else
219
220
- PrintExit(this, new PrintExitEventArgs(doc, errorCode));
221
+ throw new DocoptExitException(doc);
222
}
223
224
/// <summary>
0 commit comments