Skip to content

Instantly share code, notes, and snippets.

@Kritner
Last active June 2, 2017 12:29
Show Gist options
  • Save Kritner/be33dab144c0d7fdabf2f9cbb093dda6 to your computer and use it in GitHub Desktop.
Save Kritner/be33dab144c0d7fdabf2f9cbb093dda6 to your computer and use it in GitHub Desktop.
Old vs new (Tuples)
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);
}
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