Setting the default value of a C# Optional Parameter

后端 未结 3 1889
甜味超标
甜味超标 2020-12-01 17:58

Whenever I attempt to set the default value of an optional parameter to something in a resource file, I get a compile-time error of

Default parameter

3条回答
  •  隐瞒了意图╮
    2020-12-01 18:29

    No, you will not be able to make the resource work directly in the default. What you need to do is set the default value to something like null and then do the resource lookup when the parameter has the default value in the body of the method.

提交回复
热议问题