If String array Contains a String value - CSharp System

CSharp examples for System:Array String

Description

If String array Contains a String value

Demo Code


using System.Text;
using System;//  w w w .  j a v a 2  s  . c om

public class Main{
        public static bool Contains(this string[] array, string s)
        {
            foreach (var a in array)
            {
                if (a == s)
                {
                    return true;
                }
            }
            return false;
        }
}

Related Tutorials