Created
April 11, 2016 15:30
-
-
Save JustinJohnWilliams/d93f45f70d0f2cbfb5acc82dbca0ef9f 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
{ | |
{ new Func<int, bool>(x => x % 3 == 0), new Func<int, string>(x => "Fizz") }, | |
{ new Func<int, bool>(x => x % 5 == 0), new Func<int, string>(x => "Buzz") }, | |
{ new Func<int, bool>(x => x % 3 != 0 && x % 5 != 0), new Func<int, string>(x => x.ToString()) }, | |
{ new Func<int, bool>( x => true), new Func<int, string>(x => "\n" ) } | |
}; | |
var output = from n in Enumerable.Range(1, 100) | |
from f in rules | |
where f.Key(n) | |
select f.Value(n); | |
output.ToList().ForEach(Console.WriteLine); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment