Skip to content

Instantly share code, notes, and snippets.

@srdjan
Last active August 29, 2015 14:01
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 srdjan/9f72301d2cda3f92f6f4 to your computer and use it in GitHub Desktop.
Save srdjan/9f72301d2cda3f92f6f4 to your computer and use it in GitHub Desktop.
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