Skip to content

Instantly share code, notes, and snippets.

@frankhale
Created June 15, 2012 02:58
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 frankhale/2934457 to your computer and use it in GitHub Desktop.
Save frankhale/2934457 to your computer and use it in GitHub Desktop.
Just a little test of lambda's
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LambdaTest
{
class Program
{
static void Main(string[] args)
{
List<string> foo = new List<string>()
{
"Hello", "World", "C# is awesome!"
};
foo.DoForEach(x => Console.WriteLine(x));
}
}
public static class Extensions
{
public static void DoForEach<T>(this List<T> l, Action<T> a)
{
foreach (T t in l)
{
a(t);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment