IDE0059 Unnecessary assignment of a value to 'result'

后端 未结 1 790
南方客
南方客 2021-01-26 19:37
protected async Task HandleValidSubmit()
{
     Mapper.Map(EditEmployeeModel, Employee);

     Employee result = null;

     if (Employee.EmployeeId != 0)
     {
                


        
相关标签:
1条回答
  • 2021-01-26 19:57

    Both branches of the if and the else assign a value to result, so you don't need to initialize it with null. This null is never read and will just be overwritten anyway.

    0 讨论(0)
提交回复
热议问题