fork(2) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. Dictionary<int, string> d = new Dictionary<int, string>();
  10. d.Add(1000, "F1");
  11. d.Add(1001, "F2");
  12. d.Add(1002, "F1");
  13. d.Add(1003, "F4");
  14. d.Add(1004, "F2");
  15.  
  16. var dublicate = d.ToLookup(x => x.Value, x => x.Key).Where(x => x.Count() > 1);
  17.  
  18. foreach (var i in dublicate)
  19. {
  20. Console.WriteLine(i.Key);
  21. }
  22. }
  23. }
Success #stdin #stdout 0.05s 34088KB
stdin
Standard input is empty
stdout
F1
F2