Simplify if(x == 1 || x == 2)
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3907299/c-sharp-if-statements-matching-multiple-values">C# if statements matching multiple values</a>  </p>
</blockquote>



<p>I often find myself writing code where a variable can be either A or B, for example when I call OnItemDataBound on a repeater: </p>

<pre><code>protected void repeater_OnItemDataBound(object sender, RepeaterItemEventArgs e)
{
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {}
}
</code></pre>

<p>I then often think, there must be a simpler way of doing this. I would like to write something like:</p>

<pre><code>if(x == (1 || 2))
</code></pre>

<p>SQL has the IN(..) operator, is there something similar in C#?</p>

<pre><code>WHERE x IN(1,2)
</code></pre>

<p>I know I could use a switch-statement instead, but thats not simple enought. I want it to be done in an If statement, if possible.</p>
