Created
March 6, 2013 18:15
-
-
Save agilejon/5101647 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
// I have some list of things (typically IDs) that I want to do work on. | |
var fooIds = fooObjects.Select(f => f.FooId).ToList(); | |
// #1 | |
// This is my preference, because it's easier (for me) to spot the fact that we are taking some kind of important action. | |
// Examples 2 and 3 are easier to mis-read. At first glance I read them as somehow querying/filtering/modifying the list | |
// of ids, instead of as taking some kind of action on them. | |
foreach (var fooId in fooIds) | |
{ | |
teamService.NotifyFooChanged(fooId); | |
} | |
// #2 | |
fooIds.ForEach(fooId => teamService.NotifyFooChanged(fooId)); | |
// #3 | |
fooids.ForEach(teamService.NotifyFooChanged); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment