Boolean Expression in .NET: strName IN ("CHRIS","TOM","TYLER")

24. June 2005


I think it would be really helpful if we could do boolean expressions with IN sort of like we can in SQL.

For Example:
   'just like SQL
   If strName IN ("CHRIS","TOM","TYLER") Then
      'do something
   End If

   'using an array for this would be best
   Dim arrNames() AS String = New Array{"CHRIS", "TOM", "TYLER"}
   If strName IN arrNames Then
      'do something
   End If

   'or like this
   If strName IN New Array{"CHRIS", "TOM", "TYLER"} Then
      'do something
   End If

p.s. You'll have to excuse any bad code grammar, I typed this straight from my head

General , ,



Comments

pmpjr
pmpjr
4/10/2006 12:11:00 PM #
Ever find out if this is possible?
warnat
warnat
5/15/2006 9:41:00 AM #
if (new ArrayList(new string[] { "hello", "test", "OK" }).Contains("hello"))
    Console.WriteLine("found");
Comments are closed