winform的属性设置

雍和与木 2014-05-27 05:27:31
public static CommandSender Instance
{
get { return device ?? (device = new CommandSender()); }
}

谁能给解释一下这个属性设置是什么意思
...全文
133 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunny906 2014-05-27
  • 打赏
  • 举报
回复
??
引用 2 楼 duanzi_peng 的回复:

if( device  == null){
   device = new CommandSender();
}
+1
引用 3 楼 caozhy 的回复:
return device != null ? device : new CommandSender();
+1 ?? 是 null 合并运算符
threenewbee 2014-05-27
  • 打赏
  • 举报
回复
return device != null ? device : new CommandSender();
exception92 2014-05-27
  • 打赏
  • 举报
回复

if( device  == null){
   device = new CommandSender();
}

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧