我想知道是否有人可以为此代码提出缩短版本:
MyObject theObject = ObjectCollection.GrabAnObject();
if (theObject == null) return String.Empty;
else return theObject.myProperty;
Run Code Online (Sandbox Code Playgroud)
谢谢!
MyObject theObject = ObjectCollection.GrabAnObject();
return theObject == null ? String.Empty : theObject.myProperty;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
512 次 |
| 最近记录: |