NSwag icon indicating copy to clipboard operation
NSwag copied to clipboard

Fix: C# Code Generation generates method with return default(void)

Open nzeemin opened this issue 2 years ago • 1 comments

This PR is made to avoid generation of C# code like this one (which leads to compilation error of course):

                        if (status_ == 204)
                        {
                            return default(void);
                        }

See also issues #3912, #3996.

nzeemin avatar Mar 19 '24 16:03 nzeemin

The example bellow:

if (status_ == 204)
{
    return default(void);
}

should be

if (status_ == 204)
{
    return; // or return default;
}

But the question is what should we do with 200? I assume having "no result or default" is wrong.

fairking avatar Aug 06 '24 08:08 fairking