<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # ^ 運算符(C# 參考) 二元 **^** 運算符是為整型和 **bool** 類型預定義的。對于整型,**^** 將計算操作數的按位“異或”。對于 **bool** 操作數,**^** 將計算操作數的邏輯“異或”;也就是說,當且僅當只有一個操作數為 **true** 時,結果才為 **true**。 ## 備注 用戶定義的類型可重載 **^** 運算符(請參見[運算符](https://msdn.microsoft.com/zh-CN/library/s53ehcz3.aspx))。 對于整數類型適用的運算對枚舉類型通常也適用。 ``` class XOR { static void Main() { // Logical exclusive-OR // When one operand is true and the other is false, exclusive-OR // returns True. Console.WriteLine(true ^ false); // When both operands are false, exclusive-OR returns False. Console.WriteLine(false ^ false); // When both operands are true, exclusive-OR returns False. Console.WriteLine(true ^ true); // Bitwise exclusive-OR // Bitwise exclusive-OR of 0 and 1 returns 1. Console.WriteLine("Bitwise result: {0}", Convert.ToString(0x0 ^ 0x1, 2)); // Bitwise exclusive-OR of 0 and 0 returns 0. Console.WriteLine("Bitwise result: {0}", Convert.ToString(0x0 ^ 0x0, 2)); // Bitwise exclusive-OR of 1 and 1 returns 0. Console.WriteLine("Bitwise result: {0}", Convert.ToString(0x1 ^ 0x1, 2)); // With more than one digit, perform the exclusive-OR column by column. // 10 // 11 // -- // 01 // Bitwise exclusive-OR of 10 (2) and 11 (3) returns 01 (1). Console.WriteLine("Bitwise result: {0}", Convert.ToString(0x2 ^ 0x3, 2)); // Bitwise exclusive-OR of 101 (5) and 011 (3) returns 110 (6). Console.WriteLine("Bitwise result: {0}", Convert.ToString(0x5 ^ 0x3, 2)); // Bitwise exclusive-OR of 1111 (decimal 15, hexadecimal F) and 0101 (5) // returns 1010 (decimal 10, hexadecimal A). Console.WriteLine("Bitwise result: {0}", Convert.ToString(0xf ^ 0x5, 2)); // Finally, bitwise exclusive-OR of 11111000 (decimal 248, hexadecimal F8) // and 00111111 (decimal 63, hexadecimal 3F) returns 11000111, which is // 199 in decimal, C7 in hexadecimal. Console.WriteLine("Bitwise result: {0}", Convert.ToString(0xf8 ^ 0x3f, 2)); } } /* Output: True False False Bitwise result: 1 Bitwise result: 0 Bitwise result: 0 Bitwise result: 1 Bitwise result: 110 Bitwise result: 1010 Bitwise result: 11000111 */ ``` 在前面的示例中,0xf8 ^ 0x3f 的計算對以下兩個二進制值(分別對應于十六進制值 F8 和 3F)執行按位“異或”運算: 1111 1000 0011 1111 “異或”運算的結果是 1100 0111,即十六進制值 C7。 ## 請參閱 [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>

                              哎呀哎呀视频在线观看