Last active
November 16, 2020 14:16
-
-
Save controlflow/9c5b4b58e6b3e89abb3755ccdd6e55f2 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
if (pattern is IPatternWithDesignation withDesignation) | |
{ | |
var existingDesignation = withDesignation.Designation; | |
if (existingDesignation != null && !(existingDesignation is IDiscardDesignation)) return false; | |
} |
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
// after "Merge sequential patterns" | |
if (pattern is IPatternWithDesignation withDesignation) | |
{ | |
var existingDesignation = withDesignation.Designation; | |
if (existingDesignation is { } and not IDiscardDesignation) return false; | |
} |
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
// after "Replace `and` with `or`" | |
if (pattern is IPatternWithDesignation withDesignation) | |
{ | |
var existingDesignation = withDesignation.Designation; | |
if (existingDesignation is not (null or IDiscardDesignation)) return false; | |
} |
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
// inline variable, merge ifs, merge sequential patterns into recursive | |
if (pattern is IPatternWithDesignation { Designation: not (null or IDiscardDesignation) }) | |
return false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment