Is there a way to omit out parameter? [duplicate]

You cannot do this, but there’s no rule saying that you have to use the value that comes back. You can simply pass a temporary variable that you never use again.

C# 4.0 allows optional parameters, but out parameters can’t be optional.

EDIT: BTW, you can also overload the method:

int DoStuff()
{
    int temp;
    return DoStuff(out temp);
}

int DoStuff(out outParam)
{
    //...
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)