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

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

    I think the main reason is "...Although return values are commonplace and heavily used, the correct application of out and ref parameters requires intermediate design and coding skills. Library architects who design for a general audience should not expect users to master working with out or ref parameters."

    Please read more at: http://msdn.microsoft.com/en-us/library/ms182131.aspx

提交回复
热议问题