Is In Collection - CSharp System.Collections

CSharp examples for System.Collections:ICollection

Description

Is In Collection

Demo Code


using System.Globalization;
using System.Collections.Generic;
using System.Collections;
using System;/*www.  j a v  a 2 s .c  om*/

public class Main{
        /// <summary>
      /// 
      /// </summary>
      /// <typeparam name="U"></typeparam>
      /// <param name="collection"></param>
      /// <param name="value"></param>
      /// <returns></returns>
      public static bool IsInCollection<U> (ICollection<U> collection, U value)
      {
         if (collection == null || value == null)
            return false;
         return collection.Contains (value);
      }
}

Related Tutorials