>/// <summary> >/// Receives an expression and a list of values as parameter and returns a true >/// if the expression exists in the list. Please note that the Visual FoxPro's >/// InList() function has a limitation of in items whereas this one does not have >/// a limitation on the number of items passed. >/// </summary> >/// <example> >/// Console.WriteLine(InList("Kamal", "Pat", "abc", "Kamal")); //returns true >/// Console.WriteLine(InList("Kamal", "Pat", "abc", "xyz")); //returns false >/// Console.WriteLine(InList(123, 12, 13, 16, 1717, 123)); //returns true >/// </example> >/// <param name="tcExpression"></param> >/// <param name="toVar"></param> >/// <returns></returns> >public static bool InList(object toExpression, params object[] toItems) >{ > return Array.IndexOf(toItems, toExpression) > -1; >} >>
ildasm string[] call bool [System.Core]System.Linq.Enumerable::Contains<string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>, !!0) ildasm object[] call bool [System.Core]System.Linq.Enumerable::Contains<object>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,!!0)(2) Here I am not surprised - with value types - taken int to test