c# search list code example

Example 1: find a value in list of objects in c#

var item = TextPool.FirstOrDefault(o => o.Name == "test");
if (item != null)
       item.value = "Value";

Example 2: find value in object c#

var item = TextPool.FirstOrDefault(o => o.Name == "test");
if (item != null)
       item.value = "Value";

Example 3: how to locate a specific element in a list c#

//7 will be the spot in the list
List<int> intList = new List<int>();
int x = List[7];

Example 4: list search c#

list.Where(x => x.Name == "theName");
return list;

Example 5: search letters in list c#

The characters of the string are : 
w  3  r  e  s  o  u  r  c  e  .  c  o  m