Array Contains - CSharp System

CSharp examples for System:Array Search

Description

Array Contains

Demo Code

// All rights reserved. 
using System.Diagnostics.Contracts;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//  ww w  .j  ava 2 s. c o m

public class Main{
    private static bool ArrayContains<T>(T[] array, T item) {

      foreach (T x in array)
        if (item.Equals(x))
          return true;
      return false;
    }
}

Related Tutorials