Last active
August 29, 2015 14:01
-
-
Save srdjan/9f72301d2cda3f92f6f4 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
namespace ConsoleApplication1 { | |
class Program { | |
static void Main() { | |
//-- define an Action that will perfom a query | |
Action<List<string>> query = r => r.AddRange(QuerySomething()); | |
//-- invoke it and show results ;) | |
var result = new List<string>(); | |
query(result); | |
result.ForEach(Console.WriteLine); | |
Console.ReadLine(); | |
} | |
static IEnumerable<string> QuerySomething() { | |
yield return "just "; | |
yield return "for "; | |
yield return "fun "; | |
yield return ":) "; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment