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.
<
You can resolve this issue by :
If an exception occurs in your try
block before the return
statement, the catch
is executed and that does not return anything, because you did not tell it to.
You can do one of these:
catch
block. Do this only if it makes sense and you have a sensible value you can return. Be aware that returning null
is a usual source of bugs and there are patterns out there to avoid just that.throw;