CSharp examples for System:Array Search
Check if the array contains a value
using System.Text; using System.Linq; using System.Collections.Generic; using System;// w ww.j av a2 s. c o m public class Main{ /// <summary> /// Check if the array contains a value /// </summary> /// <param name="arr">Haystack</param> /// <param name="obj">Needle</param> /// <returns></returns> public static bool Has(dynamic arr, dynamic obj) { foreach(dynamic curr in arr) { if (Compare.Equal(curr, obj)) return true; } return false; } }