[Solved] C# console application returns: “not all code paths return a value” [closed]


You need to return a string value from DoWork function.

this code only execute Working function, but didn’t return string value from DoWork function.

public string DoWork()
{
    Working();
}

so you might return a value from DoWork function because DoWork method signature must return a string value.

public class SomeType
{
    public string DoWork()
    {
        return Working();
    }

    public string Working()
    {
        return "some string";
    }
}

0

solved C# console application returns: “not all code paths return a value” [closed]