>>>static bool Inlist(string s, params string[] list) >>>{ >>> for (int i = list.Length; --i >= 0; ) >>> if (s.CompareTo(list[i]) == 0) >>> return true; >>> return false; >>>} >>>>>
>static void doit() >{ > bool il = Inlist("001", "001", "002", "003"); > Console.WriteLine("Inlist: " + il); >} >static bool Inlist(string s, params string[] list) >{ > return list.Contains(s); >} >>But you're right, Contains() is less code
bool il = Inlist("001", "001", "002", "003");Neat!. I'd forgotten you could use that to create the array....