Posts

Showing posts from May, 2011

C# Functional programming

namespace Test { public static class Extensions { //ForEach IEnumerable extension public static void ForEach<T>( this IEnumerable<T> source, Action<T> action) { foreach (var item in source) { action(item); } } } class Person { public string Name { get ; set ; } public string City { get ; set ; } } class Account { public string Name { get ; set ; } public string AccountName { get ; set ; } public double Amount { get ; set ; } public List< string > Cards { get ; set ; } } [TestFixture] public class TestFunc { private List<Person> people; private List<Account> accounts; [TestFixtureSetUp] public void SetUp() { people = new List<Person>(); people.Add( new Person(){Name=" J