Why are 'out' parameters in .NET a bad idea?

后端 未结 22 2676
余生分开走
余生分开走 2020-12-25 10:54

Why are \'out\' parameters in .NET a bad idea?

I was recently asked this, but I had no real answer besides it\'s simply unnecessarily complicating an application. Wh

22条回答
  •  一生所求
    2020-12-25 11:41

    The out variable is not bad anyway, its really a cool stuff to use out if we need to return multiple (2 specifically) variables from a function. Sometimes its really tedious work to create a custom object just for the purpose of returning 2 variables, out is the ultimate solution.

提交回复
热议问题