N
Nenad Dobrilovic
Hi,
I have function which is throwning exception, like this:
public class LoggedException : Exception
{
public void Throw()
{
throw this;
}
}
I am using like this:
public int fun()
{
if (..)
return 0;
(new LoggedException()).Throw(); <-- Compiler Error CS0161
}
But I get 'Compiler Error CS0161: not all code paths return a value'.
How can I tell to compiler that I don't need return value when I call
Throw() function?
Thank you,
Nenad
I have function which is throwning exception, like this:
public class LoggedException : Exception
{
public void Throw()
{
throw this;
}
}
I am using like this:
public int fun()
{
if (..)
return 0;
(new LoggedException()).Throw(); <-- Compiler Error CS0161
}
But I get 'Compiler Error CS0161: not all code paths return a value'.
How can I tell to compiler that I don't need return value when I call
Throw() function?
Thank you,
Nenad