Why can't an out parameter have a default value?

后端 未结 5 808
心在旅途
心在旅途 2020-12-18 21:24

Currently when trying to do something in a method that takes an out parameter, I need to assign the value of the out parameter in the method body, e.g.

publi         


        
5条回答
  •  [愿得一人]
    2020-12-18 22:07

    Even if it allowed you to give a default value like that, it would still require you to assign value for the parameter for all returns. So your default value will be overridden.

提交回复
热议问题