I am looking for a way to get the index of all elements in a list from a keyword search within the list. So for example my list has:
Hello World
Programming
searchInList.Select((value, index) => new {value, index})
.Where(a => string.Equals(a.value, "Hello World"))
.Select(a => a.index)
If you're trying to search for more than just "Hello World"
, you could do
searchInList.Select((value, index) => new {value, index})
.Where(a => stringsToSearchFor.Any(s => string.Equals(a.value, s)))
.Select(a => a.index)