Skip to content

Instantly share code, notes, and snippets.

@shawnwildermuth
Created September 28, 2018 16:39
Show Gist options
  • Save shawnwildermuth/0bdbc32c88de6121efc252e8bf789006 to your computer and use it in GitHub Desktop.
Save shawnwildermuth/0bdbc32c88de6121efc252e8bf789006 to your computer and use it in GitHub Desktop.
var result = someCollection
.Where(c => c.Married && c.Gender == Genders.Female)
.OrderBy(c => c.LastName)
.ForEach(c =>
{
c.LastName = $"{c.LastName}-{c.Partner.LastName}";
});
@JerryNixon
Copy link

Don't stop there!

var race = cars
    .Where(x => x.Fuel > .5)
    .Where(x => x.TirePressure = 55d)
    .ForEach(x => x.Start())
    .Where(x => Equals(x.Ready, true))
    .ForEach(x => x.Shift(Gears.Drive))
    .OrderBy(x => x.Position)
    .ForEach(x => x.Accelerate(.7))
    .Select(x => x.Telemetry);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment