osyris zosar

osyris zosar

  • NA
  • 289
  • 27k

Getting index of all items containing a value using Linq

Dec 27 2020 2:00 AM
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)