小编Abi*_*Abi的帖子

visual studio提供将c#中的Expression-body转换为块体的方法:IDE0022

public ActionResult Edit(int id)
        => Json(_itemMasterBL.GetItemMaster()?.Where(x => x.Id == id).FirstOrDefault(), JsonRequestBehavior.AllowGet);
Run Code Online (Sandbox Code Playgroud)

我将上面的代码作为表达式方法(c#6.0).但是在visual studio 2017快速动作(ctrl +.)建议是 IDE0022:使用块体方法 如下,

public ActionResult Edit(int id)
    {
        return Json(_itemMasterBL.GetItemMaster()?.Where(x => x.Id == id).FirstOrDefault(), JsonRequestBehavior.AllowGet);
    }
Run Code Online (Sandbox Code Playgroud)

任何想法为什么会这样???

.net c# c#-6.0 visual-studio-2017

4
推荐指数
1
解决办法
2768
查看次数

标签 统计

.net ×1

c# ×1

c#-6.0 ×1

visual-studio-2017 ×1