C# language features that are rarely used but can be useful
2012-03-27 07:15
302 查看
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 ...)
'@' 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 ...)
相关文章推荐
- C# language features that are rarely used but can be useful
- there are no resources that can be add
- There are no resources that can be added or removed from the server.
- There are no resources that can be added or removed from the server(转)
- Entity Framework 中 使用Include 解决ObjectContext instance has been disposed and can no longer be used for operations that require a connection错误 -原创
- [The primary GPT table is corrupt, but the backup appears OK, so that will be used]的修复办法
- There are no resources that can be added or removed from the server
- There are no resources that can be added or removed from the server. .
- Secured RESTful API that can be used by Web App
- 【问题】There are no resources that can be added or removed from the server
- eclipse Tomcat :There are no resources that can be added or removed from the server
- Publishers require that PDF font are embedded so that documents can be printed everywhere...
- tomcat启动时出现There are no resources that can be added or removed from the server.
- you are calling a UIKit method that can only be invoked from the UI thread.
- tomcat添加项目(Add and Remove...)出现There are no resources that can be added or removed from the server
- Silverlight + WCF + EF4 调用出错,Server 端的Exception:The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
- <<< Tomcat 部署项目There are no resources that can be added or removed from the server
- tomcat 部署项目 there are no resources that can be add
- What can I learn right now in just 10 minutes that could be useful for the rest of my life?
- What can I learn right now in just 10 minutes that could be useful for the rest of my life?