In value in IEnumerable or Array - CSharp System

CSharp examples for System:Array Enumerate

Description

In value in IEnumerable or Array

Demo Code


using System.Text;
using System.Runtime.CompilerServices;
using System.Linq;
using System.Collections.Generic;
using System;/*from   w w w. j  a va 2 s.c o  m*/

public class Main{
        public static bool In<T>(this T t, IEnumerable<T> enumerable)
        {
            return enumerable.Contains<T>(t);
        }
        public static bool In(this string str, params string[] args)
        {
            foreach (string str2 in args)
            {
                if (str2.Equals(str))
                {
                    return true;
                }
            }
            return false;
        }
}

Related Tutorials