LINQ: GroupBy

The goal of this project is to group the sequence of data that contains 'Month' field by seasons like 'Winter' or 'Summer' which achieved by creating the delegate that sorts out the months.


//Class to hold outside source items 
class Grouping<T,IEnumerable> 
{
     T Key { ; ; }
     IEnumerable <T> Elements; 
}      
struct Sityevent { public  Name; public  Year; public  Month; }
static <Sityevent> events = new[]{
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month=},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =},
    Sityevent{ Name=, Year = , Month =}
};
In Main() instantiate objects of Type Grouping to hold each season months 
Grouping<,IEnumerable<>> fall=  Grouping<,IEnumerable<>> 
  {Elements=new[]{,,},Key=}; 
Grouping<,IEnumerable<>> winter=new Grouping<,IEnumerable<>> 
  {Elements = new[] {,,},Key=}; 
Grouping<, IEnumerable<>> spring=new Grouping<,IEnumerable<>>
  {Elements = new[] {,,},Key=}; 
Grouping<,IEnumerable<>> summer=new Grouping<,IEnumerable<>>
  {Elements = new[] {,,},Key=}; 
<,IEnumerable<>>[] seasons=new[]{fall,winter,spring,summer}; 
           
//Group our city events by the key from outside source(seasons) 
 expr2 =  e  events
             s  seasons
             s.Elements.Contains(e.Month)
             e  s.Key;
             
foreach ( group  expr2) 
{
   .Write(group.Key + "\tCount: " + group.Count().To() + "\n"); 
    (var item in group) 
   { 
     Console.Write(.Format("{0,-30} {1} {2}\n",item.Name,item.Month,item.Year)); 
   } 
   Console.WriteLine("\n"); 
} 
Console.ReadLine();