<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 Warning (level 1) CS1956 成員“name”實現類型“type”中的接口成員“name”。在運行時有多個與該接口成員相匹配的項。將調用哪個方法取決于具體的實現。 如果兩個接口方法的唯一區別在于:某個特定參數被**ref** 還是 **out**標記,則將生成此警告。最好更改代碼以避免此警告,因為在運行時實際將調用哪個方法并不十分明顯,或者無法保證在運行時將調用哪個方法。 盡管 C# 可以區分 **out** 和**ref**,CLR 卻無法區分它們。決定實現接口的方法時,CLR 只是從中任選一個。 ## 避免此警告 1. 為編譯器提供某種方式來區分這兩個方法。例如,可以為這兩個方法提供不同的名稱,或者為其中一個方法提供附加參數。 下面的代碼將生成 CS1956,因為 Base 中這兩個 Test 方法的唯一區別在于它們的第一個參數上的 ref/out 修飾符: ``` // cs1956.cs class Base<T, S> { // This is the method that should be called. public virtual int Test(out T x) // CS1956 { x = default(T); return 0; } // This is the "last" method and is the one that ends up being called public virtual int Test(ref S x) { return 1; } } interface IFace { int Test(out int x); } class Derived : Base<int, int>, IFace { static int Main() { IFace x = new Derived(); int y; return x.Test(out y); } } ```
                  <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>

                              哎呀哎呀视频在线观看