有些传统的写法,可以简写,之前没留意到,现在才注意到

IDE0031: Null check can be simplified 

 entity.Unit = entity.Unit == null ? null : entity.Unit.Trim();

可以改成

 entity.Unit = entity.Unit?.Trim();


IDE0029 可以简化 Null 检查。 

c.DeedTaxStatus==null?"未缴清": c.DeedTaxStatus,

可以改成    如果 ?? 运算符的左操作数非空,该运算符将返回左操作数,否则返回右操作数。

c.DeedTaxStatus ?? "未缴清"

IDE0037 member name can be simplified

            var results = new { smsCode = smsCode };

可以改成

            var results = new { smsCode };

 

相关文章:

  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2021-07-23
  • 2022-12-23
  • 2021-11-26
  • 2021-08-01
猜你喜欢
  • 2021-09-05
  • 2022-02-28
  • 2022-12-23
  • 2021-11-10
  • 2021-07-25
  • 2021-08-12
  • 2021-11-12
相关资源
相似解决方案