c#-运算符-空合并运算符(??)

using System;

// c#-运算符-空合并运算符
namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("空合并运算符");
            int? a = null;
            int b;
            b = a ?? 10;
            Console.WriteLine("b:"+b);
            a = 3;
            b = a ?? 10;
            Console.WriteLine("b:"+b);

        }
    }
}

c#-运算符-空合并运算符(??)_第1张图片

你可能感兴趣的:(c#-函数式编程)