Contains

Input: IEnumerable<TSource>
Optional lambda expression:TSource => TResult

Contains returns true if the given element is present:


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

class Program
{
    static void Main()
    {
        bool hasAThree = new int[] { 2, 3, 4 }.Contains(3); // true;

        Console.WriteLine(hasAThree);
    }
}

The output:


True
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.