Last active
December 16, 2015 16:39
-
-
Save shiftkey/5464745 to your computer and use it in GitHub Desktop.
LINQ-splaining
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 void Main() { | |
var found = elements.Where(e => e == "foo"); | |
// could be described as: | |
// - found is elements where e equals foo | |
// - found equals elements where e equals foo | |
var match = elements.FirstOrDefault(e => e > 0); | |
// could be described as: | |
// - match equals elements first or default where e is greater than 0 | |
// - match equals first or default in elements where e is greater than 0 | |
var viewModels = models.Select(m => CreateViewModel(m)); | |
// could be described as: | |
// - viewModels is models select CreateViewModel | |
// - viewModels is models selecting CreateViewModel | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment