C# - Error “not all code paths return a value” with an array as out parameter

后端 未结 6 1322
走了就别回头了
走了就别回头了 2021-01-24 05:49

I currently have the below code:

public int GetSeatInfoString(DisplayOptions choice, out string[] strSeatInfoStrings)

    {
        strSe         


        
6条回答
  •  春和景丽
    2021-01-24 06:02

    You are only returning a value if count <= 0. Either you need to return a value after the for loop, or change the method signature to be void, depending on what you want the return value to represent.

    If you want to return the array with the counts in, then change the return type to string[] and remove the out argument.

提交回复
热议问题