通用可变参数的参数 [英] Generic variadic parameters
问题描述
从dahlbyk这个问题的答案:的http://计算器。 COM /问题/ 4038978 /图 - 双列出成 - 一个词典式-C ,Leppie写此评论:
From dahlbyk answer to this question : http://stackoverflow.com/questions/4038978/map-two-lists-into-a-dictionary-in-c , Leppie wrote this comment:
<块引用>
怜悯,有必要为一个Zip方法。如果只有更多的静态类型语言将支持通用的可变参数的参数,选择将处理这个(如地图中的计划)。 - leppie
块引用>
这是什么意思? (我不知道计划):)
What does that mean? (I don't know Scheme) :)
推荐答案
他表示,如果C#也支持动态数字或参数(可变参数, PARAMS
),这都是一个不同的泛型类型,就不会有需要一个邮编
方法,因为它可以通过选择
覆盖。
He means, that if C# would support dynamic number or arguments (variadic, params
) which are all of a different generic type, there wouldn't be a need for a Zip
method, because it could be covered by Select
.
我不知道这是不是真的,只是解释了一句。 ..
I don't know if this is true, just interpreting the sentence ...
编辑:
我只是觉得他的意思是可变数量
I just think that he means a variable number of generic types (which is in fact only useful in combination with a variable number of method arguments), like this:
void Foo<params T>(params T[] args)
Foo(true, 7, "hello");
想想的许多声明动作< ...>
和 Func键< ...>
顺便说一句,当你不知道评论,为什么不直接问他呢?
By the way, when you are not sure about a comment, why not simply asking him?
这篇关于通用可变参数的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!