סינטקס ?? ב#c

Raist

New member
סינטקס ?? ב#c

מה אומרים ?? ב#C כמו פה
return (Int32)(ViewState["Offset"] ?? 0);​
 

J u n k y

New member
מתוך הרפרנס של #C

?? Operator (C# Reference) The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand.​
אני מודה שלא הייתי מודע לאופרטור הזה (אפילו כתבתי פונקציה IsNull שעושה בדיוק אותו דבר
).
 
למעלה