Use Contains to check the existance of an element : Contains : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Contains »

 

Use Contains to check the existance of an element








    
 
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

public class MainClass{
   public static void Main(){
       int[] numbers = { 2, 6, 1, 56, 102 };
       Console.WriteLine("Is there the number 102?");
       Console.Write(numbers.Contains(102) ? "Yes, there is" : "No, there isn't");
   }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Contains