Does optional parameter and optional attribute not supported together?

后端 未结 1 1861
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 06:53
public void ObjTest(StringBuilder sb, List list, int i = 0,  [Optional] string bs)
{
    ......
 }

The above code throwing compilation er

1条回答
  •  走了就别回头了
    2021-01-29 07:21

    You can use them in conjunction but the optional parameter (the language construct) must be the last parameter in the parameter list.

    public void X(StringBuilder sb, List list, [Optional] string bs, int i = 0)
    {
    }
    

    0 讨论(0)
提交回复
热议问题