Advertisement
Guest User

Untitled

a guest
Sep 13th, 2010
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using Habrahabr;
  3.  
  4. namespace 256Day
  5. {
  6.    private static class Program
  7.    {
  8.         [STAThread]
  9.         private static void Main(string[] args)
  10.         {
  11.             (from obj in Habrahabr.Programmers
  12.              where obj.IsActive
  13.              order by obj.FIO asceding
  14.              select obj).ForEach(Congratulate);
  15.  
  16.             Console.ReadLine();
  17.         }
  18.  
  19.         private static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
  20.         {
  21.             if((collection == null) || (action == null))
  22.                 return;
  23.  
  24.             foreach(var obj in collection)
  25.                 action(obj);
  26.         }
  27.  
  28.         private static void Congratulate(Programmer programmer)
  29.         {
  30.             Console.WriteLine("{0}, congratulations!", programmer.FI);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement