可能重複:
C# newbie: what’s the difference between 「bool」 and 「bool?」 ?什麼是雙重?在C#中是什麼意思?
嗨, 在閱讀NUnit的項目的斷言類的代碼,我碰到這種特殊的結構來 -
public static void AreEqual(double expected, double? actual, double delta)
{
AssertDoublesAreEqual(expected, (double)actual, delta ,null, null);
}
在這功能第二個輸入參數輸入爲double?
。 有趣的是,這個代碼在VS2010(C#4.0)中編譯沒有問題。 任何人都知道爲什麼這不會引發錯誤?爲什麼double?
被認爲是有效的關鍵字,對?
有什麼特別的意義。
請參閱[C#newbie:「bool」和「bool?」之間的區別是什麼? ?](http://stackoverflow.com/questions/1181491/c-newbie-whats-the-difference-between-bool-and-bool) – 2010-06-07 10:04:03
停止downvoting的傢伙,這是一個有效的問題,這是很難的人誰doesn不知道可空的操作員找到答案。只需將問題視爲完全重複即可。 – Diadistis 2010-06-07 10:07:20
這些降價是怎麼回事?問號後綴不是很搜索引擎友好。 – cfern 2010-06-07 10:07:54