Is it bad form to return Arrays in C#? Should I return List?

后端 未结 7 1071
南方客
南方客 2020-12-14 20:31

I have a function which returns a variable number of elements, should I return an array or a List? The \"collection\'s\" size does not change once returned, ie for all purpo

7条回答
  •  情歌与酒
    2020-12-14 21:31

    Expanding on Reed's answer.

    Eric Lippert did a great blog post on this very subject. It's got probably the most detailed answer available

    • http://blogs.msdn.com/ericlippert/archive/2008/09/22/arrays-considered-somewhat-harmful.aspx

提交回复
热议问题