using System;
using System.Linq;
using System.Collections.Generic;
public class Test
{
public static void Main()
{
List<int> mylist = new List<int> { 10, 11, 23, 34, 56, 43 };
List<int> newList = mylist.Select((v, i) => new { v, i })
.Where(x => x.v > 23)
.Select(x => x.i).ToList<int>();
foreach (int indices in newList)
{
Console.WriteLine(indices); // Output is 3, 4, 5
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7CiAKcHVibGljIGNsYXNzIFRlc3QKewogICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKICAgICAgICB7CiAgICAgICAgICAgIExpc3Q8aW50PiBteWxpc3QgPSBuZXcgTGlzdDxpbnQ+IHsgMTAsIDExLCAyMywgMzQsIDU2LCA0MyB9OwogICAgICAgICAgICBMaXN0PGludD4gbmV3TGlzdCA9IG15bGlzdC5TZWxlY3QoKHYsIGkpID0+IG5ldyB7IHYsIGkgfSkKICAgICAgICAgICAgICAgICAgICAgICAgLldoZXJlKHggPT4geC52ID4gMjMpCiAgICAgICAgICAgICAgICAgICAgICAgIC5TZWxlY3QoeCA9PiB4LmkpLlRvTGlzdDxpbnQ+KCk7CiAKICAgICAgICAgICAgZm9yZWFjaCAoaW50IGluZGljZXMgaW4gbmV3TGlzdCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoaW5kaWNlcyk7IC8vIE91dHB1dCBpcyAzLCA0LCA1CiAgICAgICAgICAgIH0KICAgICAgICB9Cn0=