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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # ?? 運算符(C# 參考) **??** 運算符稱作 null 合并運算符。如果此運算符的左操作數不為 null,則此運算符將返回左操作數;否則返回右操作數。 ## 備注 可以為 null 的類型可以表示類型的域中的值,或者值可以是未定義的(在這種情況下,值為 null)。當左操作數具有一個值為 null 的可以為 null 的類型時,可以使用 **??** 運算符的語法表現力來返回適當的值(右操作數)。如果在嘗試將可以為 null 值的類型分配給不可以為 null 值的類型時沒有使用 **??** 運算符,則會生成編譯時錯誤。如果使用強制轉換,且當前未定義可以為 null 值的類型,則會引發 **InvalidOperationException** 異常。 有關詳細信息,請參閱[可以為 null 的類型(C# 編程指南)](https://msdn.microsoft.com/zh-CN/library/1t3y8s4s.aspx)。 即使 ?? 運算符的兩個參數都是常量,也不能將其結果視為常量。 ``` class NullCoalesce { static int? GetNullableInt() { return null; } static string GetStringValue() { return null; } static void Main() { int? x = null; // Set y to the value of x if x is NOT null; otherwise, // if x = null, set y to -1. int y = x ?? -1; // Assign i to return value of the method if the method's result // is NOT null; otherwise, if the result is null, set i to the // default value of int. int i = GetNullableInt() ?? default(int); string s = GetStringValue(); // Display the value of s if s is NOT null; otherwise, // display the string "Unspecified". Console.WriteLine(s ?? "Unspecified"); } } ``` ## 請參閱 [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) [可以為 null 的類型(C# 編程指南)](https://msdn.microsoft.com/zh-CN/library/1t3y8s4s.aspx) [“提升”的準確含義是什么?](http://go.microsoft.com/fwlink/?LinkID=112382)
                  <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>

                              哎呀哎呀视频在线观看