Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


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

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

blog comments powered by Disqus