Created
November 29, 2022 22:51
-
-
Save AnthonyGiretti/f452ae0a025f50ca35daaa0269fa5db5 to your computer and use it in GitHub Desktop.
Example of C# 11 List pattern syntax on vowels and consonants arrays
This file contains hidden or 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
namespace Csharp11Demo.Models; | |
string[] consonants = { "b", "d", "k", "l" }; | |
string[] vowels = { "a", "e", "o", "l" }; | |
consonants is ["b", "d", "k", "l" ]; // returns true | |
vowels is ["b", "d", "k", "l"]; // returns false | |
consonants is ["b", "d", "k"]; // returns false | |
consonants is [_, "d", "k", _]; // returns true | |
vowels is [.., "l"]; // returns true | |
consonants is [_, "d", ..]; // returns true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment