Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

前端 未结 3 653
既然无缘
既然无缘 2020-12-19 10:25

I have this foreach section and i am trying to add a line after my \"result = string.Format\" but i get the following error \"Only assignment, call, increment, decrement, aw

3条回答
  •  爱一瞬间的悲伤
    2020-12-19 11:13

    result.StartsWith("/") && result.EndsWith("/") ? result.Replace("/", string.Empty) : result;
    

    This line does nothing with the result of the ternary operator. I assume you'd want to assign it to result

提交回复
热议问题