From: Patrice on
> I am not asking for SQL, I know SQL syntax. But what I want
> is how to write in C# that is to find a value which is
> in a collection or array or list. for example, does c# have Var_A in
> ('aaa','bbb','ccc') . do it by collection or array?
> Any example web page? Thanks.

So I confirm my previous post. You'll find a method called "Contains" on
most if not all lists. See for example :

http://msdn.microsoft.com/en-us/library/bhkz42b3.aspx

--
Patrice


From: Jeff Johnson on
"J.B. Moreno" <planB(a)newsreaders.com> wrote in message
news:240320100828505325%planB(a)newsreaders.com...

>> In SQL, there is a condition IN . e.g. products in (a,b,c). I
>> want to know whether there exist a same statement in C#. Or maybe I
>> should use other syntax? Thanks.
>
> Most collection classes such as arrays and list have a method named
> "Contains". So you declare your array myarray and then see if it has
> what your looking for using myarray.Contains(whatever).
>
> You can also use LINQ to do the same thing.

Actually, the only reason arrays appear to have a Contains() method is due
to System.Linq being referenced. Comment that out of your code and all those
extension methods disappear. Just wanted to make it clear that arrays do not
"natively" have a Contains() method.