Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP inlist() in c#
Message
 
 
To
02/06/2008 07:05:10
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01320903
Message ID:
01320926
Views:
48
>>if there any similar vfp inlist() command in C#?
>>
>>
>>for eg.
>>
>>VFP Code:
>>
>>IF INLIST(postCode,'001','002','003')
>>...
>>ENDIF
>>
>>
>>
>>Thanks.
>
>As far as I know, there isn't. You can easily write one - and overload it for other types
>
>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;
>}
>
Short and sweet. Just wondering, is there a reason for traversing the parameter list backwards?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform