fork download
  1. using System;
  2. using System.Data.Linq;
  3. using System.Xml;
  4. using System.Xml.Linq;
  5.  
  6. namespace linqsamples
  7. {
  8. /// <summary>
  9. /// Summary description for LinqSample
  10. /// </summary>
  11. class LinqSample
  12. {
  13. public static void Main()
  14. {
  15. int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
  16. var numGroups = from n in numbers group n by n % 5 into g
  17. select new (Remainder = g.Key, Numbers = g);
  18.  
  19. foreach(var g in numGroups)
  20. {
  21.  
  22. Console.WriteLine("Number with remainder {0} when devided by 5:",g.Remainder);
  23.  
  24. foreach(var n in g.Numbers )
  25. {
  26. Console.WriteLine(n);
  27. }
  28. }
  29.  
  30. }
  31.  
  32. }
  33. }
  34.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(17,36): error CS1525: Unexpected symbol `(', expecting `[', `{', or `type'
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty