2023 iThome 鐵人賽
分享至
??
C#程式碼 int s1; int? s2 = null; // s2 ?? s3 if s2==null, then s3, otherwise s2 s1 = s2 ?? 0; //if s2 == null, 則s1 = 0,否則s1 = s2 Console.WriteLine("s1 == {0}", s1);
C#程式碼
int s1; int? s2 = null; // s2 ?? s3 if s2==null, then s3, otherwise s2 s1 = s2 ?? 0; //if s2 == null, 則s1 = 0,否則s1 = s2 Console.WriteLine("s1 == {0}", s1);
輸出結果
IT邦幫忙