【转】双目运算符 "??"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
  
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int? a;
            a = null;//此时输出3
            //a = 6;//此时输出6
            int b = a ?? 3;
            Console.Write(b);
            Console.ReadKey();
        }
    }
}
posted @ 2010-07-27 16:18  SeanWang  阅读(363)  评论(1编辑  收藏  举报