Check out example codes for "c# string list contains". It will help you in understanding the concepts better.

Code Example 1

// C# Program to check whether the element is present in the List or not 
using System; 
using System.Collections; 
using System.Collections.Generic; 
  
class Geeks { 
  
    // Main Method 
    public static void Main(String[] args) 
    {   
        // Creating an List<T> of Integers 
        List<int> firstlist = new List<int>(); 
  
        // Adding elements to List 
        firstlist.Add(1); 
        firstlist.Add(2); 
        firstlist.Add(3); 
        firstlist.Add(4); 
        firstlist.Add(5); 
  
        // Checking whether 4 is present in List or not 
        Console.Write(firstlist.Contains(4)); 
    } 
} 
// Result = true

Code Example 2

// To check if a list contains a certain value, use Contains():

// Creating an List<T> of Integers 
List<int> firstlist = new List<int>(); 
  
// Adding elements to List 
firstlist.Add(1); 
firstlist.Add(2); 
firstlist.Add(3); 
firstlist.Add(4); 
firstlist.Add(5); 
  
// Checking whether 4 is present in List or not 
Console.Write(firstlist.Contains(4));

Learn ReactJs, React Native from akashmittal.com