fork(2) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. List<int> mylist = new List<int> { 10, 11, 23, 34, 56, 43 };
  10. List<int> newList = mylist.Select((v, i) => new { v, i })
  11. .Where(x => x.v > 23)
  12. .Select(x => x.i).ToList<int>();
  13.  
  14. foreach (int indices in newList)
  15. {
  16. Console.WriteLine(indices); // Output is 3, 4, 5
  17. }
  18. }
  19. }
Success #stdin #stdout 0.03s 33832KB
stdin
Standard input is empty
stdout
3
4
5