Skip to content

Instantly share code, notes, and snippets.

@embix
Created November 10, 2015 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save embix/36e362d92b88c34f1297 to your computer and use it in GitHub Desktop.
Save embix/36e362d92b88c34f1297 to your computer and use it in GitHub Desktop.
Enumerable.Range(1, 100)
.Select(i => new { i, s = ""})
.Select(si => si.i%3==0? new { si.i, s = "Fizz"} : si)
.Select(si => si.i%5==0? new { si.i, s = si.s+"Buzz"} : si)
.Select(si => si.s.Length>0?new { si.i, s = si.s+Environment.NewLine} : si)
.Select(si=>si.s).Aggregate((a,b)=>a+b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment