fork download
  1. using System;
  2. using System.Globalization;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. public class Test
  7. {
  8.  
  9. public static void Main()
  10. {
  11. var list = new List<object> { "a", "b", "c", "d", "e", "a", "d" };
  12. for(int i=list.Count - 1; i >= 0; i--)
  13. {
  14. var obj = list[i];
  15. if(list.Take(i).Contains(obj))
  16. list.RemoveAt(i);
  17. }
  18.  
  19. foreach(var obj in list)
  20. Console.WriteLine(obj);
  21. }
  22. }
Success #stdin #stdout 0.03s 33912KB
stdin
Standard input is empty
stdout
a
b
c
d
e