C# Multi-Comparisons possible?

Posted by Iggy Ma on Stack Overflow See other posts from Stack Overflow or by Iggy Ma
Published on 2010-05-11T02:29:34Z Indexed on 2010/05/11 2:34 UTC
Read the original article Hit count: 265

Filed under:

is it possible in some way to compare multiple variables to one constant in a if statement? It would be very helpful if instead of

if ( col.Name != "Organization" && col.Name != "Contacts" && col.Name != "Orders" ) { }

I could just say

if ( col.Name != "Organization" || "Contacts" || "Orders" ) { }

And I know I could use a list but in some instances I dont want to... Thanks!

© Stack Overflow or respective owner

Related posts about c#