fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Item
  6. {
  7. public DateTime Date { get; set; }
  8. public string UserName { get; set; }
  9. public int Count { get; set; }
  10. }
  11.  
  12. public class Test
  13. {
  14. public static void Main()
  15. {
  16. var datenow = DateTime.Now;
  17. List<Item> mojeObiekty = new List<Item>();
  18. mojeObiekty.Add(new Item{Date = datenow});
  19. mojeObiekty.Add(new Item{Date = datenow});
  20. mojeObiekty.Add(new Item{Date = datenow.AddDays(1)});
  21. var listaTupli = mojeObiekty.GroupBy(x => x.Date).Select(group => Tuple.Create(group.UserName, group.Count()));
  22. Console.Write(listaTupli);
  23. }
  24. }
Compilation error #stdin compilation error #stdout 0.02s 131776KB
stdin
Standard input is empty
compilation info
prog.cs(21,88): error CS1061: Type `System.Linq.IGrouping<System.DateTime,Item>' does not contain a definition for `UserName' and no extension method `UserName' of type `System.Linq.IGrouping<System.DateTime,Item>' could be found. Are you missing an assembly reference?
/usr/lib/mono/4.5/System.Core.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty