<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國際加速解決方案。 廣告
                # Compiler Error CS0034 運算符“operator”對于“type1”和“type2”類型的操作數具有二義性 運算符用在了兩個對象上,并且編譯器找到多個轉換。因為轉換必須是唯一的,因此必須進行一次強制轉換,或者使其中一個轉換成為顯式轉換。有關更多信息,請參見[轉換運算符(C# 編程指南)](https://msdn.microsoft.com/zh-cn/library/09479473.aspx)。 下面的示例生成 CS0034: ``` // CS0034.cs public class A { // allows for the conversion of A object to int public static implicit operator int (A s) { return 0; } public static implicit operator string (A i) { return null; } } public class B { public static implicit operator int (B s) // one way to resolve this CS0034 is to make one conversion explicit // public static explicit operator int (B s) { return 0; } public static implicit operator string (B i) { return null; } public static implicit operator B (string i) { return null; } public static implicit operator B (int i) { return null; } } public class C { public static void Main () { A a = new A(); B b = new B(); b = b + a; // CS0034 // another way to resolve this CS0034 is to make a cast // b = b + (int)a; } } ``` 在 C# 1.1 中,一個編譯器 Bug 使其能夠定義一個類,在其中實現針對 **int** 和 **bool** 的用戶定義的隱式轉換,并對該類型的對象使用按位 **AND** 運算符 (**&**)。在 C# 2.0 中,已修復此 Bug 以使編譯器符合 C# 規范,因此以下代碼現在將導致錯誤 CS0034: ``` namespace CS0034 { class TestClass2 { public void Test() { TestClass o1 = new TestClass(); TestClass o2 = new TestClass(); TestClass o3 = o1 & o2; //CS0034 } } class TestClass { public static implicit operator int(TestClass o) { return 1; } public static implicit operator TestClass(int v) { return new TestClass(); } public static implicit operator bool(TestClass o) { return true; } } } ```
                  <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>

                              哎呀哎呀视频在线观看