??與?操作符

??: 如果操作符左邊的變量不爲空,則返回變量的值, 否則返回其右邊(變量)的值. 例: // nullable_type_operator.cs using System; class MainClass { static int? GetNullableInt() { return null; } static string GetStringValue() { return null; }
相關文章
相關標籤/搜索