C# error “Not all code paths return a value”

后端 未结 8 1862
长发绾君心
长发绾君心 2020-12-12 06:05

I translated this part of the code from vb to c# and giving me this error message. \"Not all code paths return a value\". What is the problem? Thanks in advance.

<         


        
8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 06:22

    This is a common error message in functions, as functions are designed to return some value. If your code passes the catch section, it will reach the end of the function without returning anything, thats where you need to return the value.

提交回复
热议问题