Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP inlist() in c#
Message
 
 
To
02/06/2008 07:58:19
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01320903
Message ID:
01336150
Views:
42
>I'm not passing an array as a parameter - just receiving a variable number of parameters in an array;
>
>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

Ok, I would add this function to my static class. Thanks both.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform