Last active
June 6, 2021 14:08
-
-
Save rstropek/979426774d588714269b63828392a73d to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
var heroes = new List<Hero> | |
{ | |
new("Superman", int.MaxValue), | |
new("The Tick", 10), | |
}; | |
if (heroes is { { MaxJumpDistance: > 1000 }, { MaxJumpDistance: < 100, Name: var snd } }) | |
{ | |
Console.WriteLine($"First can fly, second ('{snd}') cannot jump very far"); | |
} | |
class Hero | |
{ | |
public string Name; | |
public int MaxJumpDistance; | |
public Hero(string name, int maxJumpDistance) | |
=> (Name, MaxJumpDistance) = (name, maxJumpDistance); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment