Microsoft Most Valuable Professional

Chris Pietschmann

An MVP From Wisconsin



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

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by crpietschmann on Friday, June 24, 2005 12:00 PM
Permalink | Comments (2) | Post RSSRSS comment feed

Related posts

Comments

pmpjr

Monday, April 10, 2006 12:11 PM

pmpjr

Ever find out if this is possible?

warnat

Monday, May 15, 2006 9:41 AM

warnat

if (new ArrayList(new string[] { "hello", "test", "OK" }).Contains("hello"))
Console.WriteLine("found");

Comments are closed

About the author

I'm Chris Pietschmann, go to the About Me page to learn more about me.

Search

Sponsors

Web.Maps.VE - ASP.NET AJAX Virtual Earth Mapping Server Control

Recent comments

Disclaimer


This work is licensed under a Creative Commons Attribution 3.0 United States License, unless explicitly stated otherwise within the posted content.
© Copyright 2004 - 2008 Chris Pietschmann