Last active
June 2, 2017 12:29
-
-
Save Kritner/be33dab144c0d7fdabf2f9cbb093dda6 to your computer and use it in GitHub Desktop.
Old vs new (Tuples)
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
private readonly List<Tuple<bool, string, IFoo>> myTypes = new List<Tuple<bool, string, IFoo>>() | |
{ | |
new Tuple<bool, string, IFoo>(true, "Test", new FooOne()), | |
new Tuple<bool, string, IFoo>(true, "blah blah", new FooTwo()), | |
new Tuple<bool, string, IFoo>(false, "Test", new FooFourtyTwo()), | |
new Tuple<bool, string, IFoo>(false, "blah blah", new FooFace()), | |
}; | |
public void Thinger() | |
{ | |
var matchies = myTypes.Where(w => w.Item1); | |
} |
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
private readonly List<(bool someFlag, string someLabel, IFoo someType)> myTypes = new List<(bool someFlag, string someLabel, IFoo someType)>() | |
{ | |
(true, "Test", new FooOne()), | |
(true, "blah blah", new FooTwo()), | |
(false, "Test", new FooFourtyTwo()), | |
(false, "blah blah", new FooFace()), | |
}; | |
public void Thinger() | |
{ | |
var matchies = myTypes.Where(w => w.someFlag); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment