<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # && 運算符(C# 參考) 條件“與”運算符 (**&&**) 執行其 **bool** 操作數的邏輯“與”運算,但僅在必要時才計算第二個操作數。 ## 備注 操作 ``` x && y ``` 對應于操作 ``` x & y ``` ,但,如果 x是 **false**, y 不會計算,因為,和操作的結果是 false ,無論 y 的值為。這被稱作為“短路”計算。 不能重載條件“與”運算符,但常規邏輯運算符和運算符 [true](https://msdn.microsoft.com/zh-CN/library/eahhcxk2.aspx) 與 [false](https://msdn.microsoft.com/zh-CN/library/67bxt5ee.aspx) 的重載,在某些限制條件下也被視為條件邏輯運算符的重載。 在下面的示例中,,因為該操作數返回 false,在第二個 **if** 語句的條件表達式計算只有第一個操作數。 ``` class LogicalAnd { static void Main() { // Each method displays a message and returns a Boolean value. // Method1 returns false and Method2 returns true. When & is used, // both methods are called. Console.WriteLine("Regular AND:"); if (Method1() & Method2()) Console.WriteLine("Both methods returned true."); else Console.WriteLine("At least one of the methods returned false."); // When && is used, after Method1 returns false, Method2 is // not called. Console.WriteLine("\nShort-circuit AND:"); if (Method1() && Method2()) Console.WriteLine("Both methods returned true."); else Console.WriteLine("At least one of the methods returned false."); } static bool Method1() { Console.WriteLine("Method1 called."); return false; } static bool Method2() { Console.WriteLine("Method2 called."); return true; } } // Output: // Regular AND: // Method1 called. // Method2 called. // At least one of the methods returned false. // Short-circuit AND: // Method1 called. // At least one of the methods returned false. ``` ## C# 語言規范 有關詳細信息,請參閱 [C# 語言規范](https://msdn.microsoft.com/zh-CN/library/ms228593.aspx)。該語言規范是 C# 語法和用法的權威資料。 ## 請參閱 [C# 參考](https://msdn.microsoft.com/zh-CN/library/618ayhy6.aspx) [C# 編程指南](https://msdn.microsoft.com/zh-CN/library/67ef8sbd.aspx) [C# 運算符](https://msdn.microsoft.com/zh-CN/library/6a71f45d.aspx)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看