<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之旅 廣告
                # Compiler Error CS0019 運算符“operator”無法應用在“type”和“type”類型的操作數 對不支持二元運算符的數據類型應用該運算符。例如,您不能對字符串使用 [||](https://msdn.microsoft.com/zh-CN/library/6373h346.aspx) 運算符,不能對 [bool](https://msdn.microsoft.com/zh-CN/library/c8f5xwh7.aspx) 變量使用 [+](https://msdn.microsoft.com/zh-CN/library/k1a63xkz.aspx)、[-](https://msdn.microsoft.com/zh-CN/library/wch5w409.aspx)、[&lt;](https://msdn.microsoft.com/zh-CN/library/z5wecxwa.aspx) 或 [&gt;](https://msdn.microsoft.com/zh-CN/library/yxk8751b.aspx) 運算符,并且不能將 [==](https://msdn.microsoft.com/zh-CN/library/53k8ybth.aspx)運算符與 **struct**類型一起使用(除非該類型顯式重載了該運算符)。 如果在處理類類型時遇到此錯誤,則原因是該類未重載運算符。有關詳細信息,請參閱[可重載運算符(C# 編程指南)](https://msdn.microsoft.com/zh-CN/library/8edha89s.aspx)。 在下面的示例中,將在兩個位置生成 CS0019,原因是 C# 中的 [bool](https://msdn.microsoft.com/zh-CN/library/c8f5xwh7.aspx) 不能轉換為 [int](https://msdn.microsoft.com/zh-CN/library/5kzh1b5w.aspx)。將減法運算符應用于字符串時,還會生成 CS0019。請注意,加法運算符 (+) 可與字符串操作數一起使用,因為 **String** 類會重載該運算符以執行字符串串聯。 ``` static void Main() { bool result = true; if (result > 0) //CS0019 { // Do something. } int i = 1; // You cannot compare an integer and a boolean value. if (i == true) //CS0019 { //Do something... } // The following use of == causes no error. It is the comparison of // an integer and a boolean value that causes the error in the // previous if statement. if (result == true) { //Do something... } string s = "Just try to subtract me."; float f = 100 - s; // CS0019 } ``` 在下面的示例中,必須在 [ConditionalAttribute](https://msdn.microsoft.com/zh-CN/library/system.diagnostics.conditionalattribute.aspx) 外指定條件邏輯。只能向 [ConditionalAttribute](https://msdn.microsoft.com/zh-CN/library/system.diagnostics.conditionalattribute.aspx) 傳遞一個預定義符號。 下面的示例生成 CS0019。 ``` // CS0019_a.cs // compile with: /target:library using System.Diagnostics; public class MyClass { [ConditionalAttribute("DEBUG" || "TRACE")] // CS0019 public void TestMethod() {} // OK [ConditionalAttribute("DEBUG"), ConditionalAttribute("TRACE")] public void TestMethod2() {} } ``` ## 請參閱 [運算符(C# 編程指南)](https://msdn.microsoft.com/zh-CN/library/ms173145.aspx) [隱式數值轉換表(C# 參考)](https://msdn.microsoft.com/zh-CN/library/y5b434w4.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>

                              哎呀哎呀视频在线观看