Created
July 30, 2022 08:26
-
-
Save mirmostafa/c78a8bd7ffeddef57c5eabcd85e5414b to your computer and use it in GitHub Desktop.
IsNullOrEmpty, using pattern matching
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
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? str) => str?.Length is null or 0; | |
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? str) => str is null or { Length: 0 }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment