Best practice of using the “out” keyword in C#

后端 未结 10 2113
暗喜
暗喜 2020-12-16 11:53

I\'m trying to formalise the usage of the \"out\" keyword in c# for a project I\'m on, particularly with respect to any public methods. I can\'t seem to find any best practi

10条回答
  •  借酒劲吻你
    2020-12-16 12:27

    One advantage of out is that the compiler will verify that CalcSomething does in fact assign a value to someOtherNumber. It will not verify that the someOtherNumber field of Result has a value.

提交回复
热议问题