using System.Collections.Generic;
public class DeveloperOutput {
public string Skill {get; set;}
public List<string> Developers {get; set;}
public int Count {get; set;}
public class DeveloperInput {
public string Skill {get; set;}
public string Name {get; set;}
public static List<DeveloperInput> Developers = new List<DeveloperInput> {
new DeveloperInput {Skill = "css", Name= "Jhon"},
new DeveloperInput {Skill = "javascript",Name = "Yunus"},
new DeveloperInput {Skill = "javascript",Name = "Carol"},
new DeveloperInput {Skill = "html", Name = "Ben"},
new DeveloperInput {Skill = "html", Name = "Matt"},
new DeveloperInput {Skill = "html", Name = "Jack"},
new DeveloperInput {Skill = "html", Name = "Pei"},
public static List<DeveloperOutput> DevelopersExpectedOutput = new List<DeveloperOutput>
new DeveloperOutput {Skill = "css", Developers = new List<string> {"John"}, Count = 1},
new DeveloperOutput {Skill = "javascript", Developers = new List<string> {"Carol", "Yunus"}, Count = 2},
new DeveloperOutput {Skill = "html", Developers = new List<string> {"Ben", "Matt", "Jack", "Pei"}, Count = 4},
public static void Main()
var groupBy = from developer in Developers
group developer by developer.Skill into groupData
select new DeveloperOutput()
Count = groupData.Count(),
Skill = groupData.FirstOrDefault().Skill,
Developers = groupData.Select(x=> x.Name).ToList()
foreach (var group in groupBy)
Console.WriteLine("Values: {0} - {1}", group.Count, group.Skill);
foreach (var dev in group.Developers)
Console.WriteLine("Developer: {0}", dev);