不应该C#4.0的新"命名参数"功能被称为"命名参数"? [英] Shouldn't C# 4.0's new "named parameters" feature be called "named arguments"?
问题描述
我想有可能是这个命名历史原因和其他语言也有类似的功能,但它也似乎我的参数一直在C#中的名称。参数是无名的。或者是有为什么选择这个术语一个特别的原因?
I suppose there could be historical reasons for this naming and that other languages have similar feature, but it also seems to me that parameters always had a name in C#. Arguments are the unnamed ones. Or is there a particular reason why this terminology was chosen?
推荐答案
是的,你是绝对正确的(在我看来,反正)。讽刺的是,虽然我平时挑剔这些方面,我仍然使用参数传递的时候我也许应该谈参数传递。我想,人们可以说C#在此之前4.0,如果你打电话给你不关心参数名的方法,而成为名时,你可以在参数指定它们的显著元数据的一部分。
Yes, you're absolutely right (to my mind, anyway). Ironically, although I'm usually picky about these terms, I still use "parameter passing" when I should probably talk about "argument passing". I suppose one could argue that prior to C# 4.0, if you're calling a method you don't care about the parameter names, whereas the names become part of the significant metadata when you can specify them on the arguments as well.
我同意它的确与众不同,这术语是非常重要的。
I agree that it makes a difference, and that terminology is important.
可选参数肯定是好的,但 - 这是添加元数据参数,当你还没来得及这样做:)(话虽如此,它不会是可选的产生IL ...计)
"Optional parameters" is definitely okay though - that's adding metadata to the parameter when you couldn't do so before :) (Having said that, it's not going to be optional in terms of the generated IL...)
你想我要求团队对他们的反馈意见?
Would you like me to ask the team for their feedback?
这篇关于不应该C#4.0的新"命名参数"功能被称为"命名参数"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!