C# - Does OR act like an Else If?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/781832/will-all-methods-in-a-logical-expressions-be-executed">Will all methods in a logical expressions be executed?</a>  </p>
</blockquote>



<p>Let me explain: let's say we have theese two codes:</p>

<pre><code>foreach(Object o in Objs)
    if(o is Class1 || o is Class2)
        DoSomething();
</code></pre>

<p>__</p>

<pre><code>foreach(Object o in Objs)
    if(o is Class1)
        DoSomething();
    else if(o is Class2)
        DoSomething();
</code></pre>

<p>Now, of course an OR is better in this case, but my question is different and just out of curiosity: when in the first case o is of type Class1, does the compiler stop and run the code or it checks what comes next anyway?
It would do that in the second case.</p>
