C# functions and optional parameters

前端 未结 4 1534
名媛妹妹
名媛妹妹 2021-01-20 11:15

I know that in C# it is possible to define optional parameters. My question is directed at how flexible this is.

Let f be a function as below, with a

4条回答
  •  误落风尘
    2021-01-20 11:40

    Using named arguments:

    f(a: 5, c: 6);
    

    Although, strictly speaking in my example, you don't have to qualify the a:

    f(5, c: 6);
    

提交回复
热议问题