4
Answers

Getting index of all items containing a value using Linq

osyris zosar

osyris zosar

4y
3.1k
1
I am just starting to learn Linq.

and i have this list 
  1. string[] names = { "jack""harry""James""peter" };  
  2.             List <string> list32 = new List<string>(names);  
 I would like to get all the index numbers of the items that contain a specific char
i have tried this
  1. var mylinqQuery = from f in list32  
  2.             where f.Contains('a')  
  3.             select f;  
 but it only returns the full names

 Can somebody help me with this
Answers (4)