C# language features that are rarely used but can be useful

Various small points that it doesn't matter too much if you don't know or use them


'@' symbol 

apart from being used in front of a string to change how compiler interpret the string (verbatim or not), it can be placed also in front of a variable which may otherwise conflict with observed word:

http://stackoverflow.com/questions/429529/what-does-the-symbol-before-a-variable-name-mean-in-c


'??' symbol

null coalesce operator, basically 'A ?? B' is equavalent to expression with tertiary operator 'A != null ? A : B', which when made a sequence may allow you to choose the first non-null:

string answer = answer1 ?? answer2 ?? answer 3 ?? ...

http://stackoverflow.com/questions/446835/what-do-two-question-marks-together-mean-in-c


(To be continued ...)


你可能感兴趣的:(language)