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

后端 未结 22 2924
余生分开走
余生分开走 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:22

    It's like the Tanqueray guy likes to say- Everything in moderation.

    I definitely would stress against over-use, since it would lead to "writing c in c#" much the same way one can write java in Python (where you're not embracing the patterns and idioms which make the new language special, but instead simply thinking in your old language and converting to new syntax). Still, as always, if it helps your code be more elegant and make more sense, rock out.

提交回复
热议问题