来自 dahlbyk 对这个问题的回答:Map two lists into a dictionary in C# , Leppie 写了这条评论:
Pity there is a need for a Zip method. If only more statically typed languages would support generic variadic parameters, Select would handle this (like map in Scheme). – leppie
这是什么意思? (我不知道方案):)
最佳答案
他的意思是,如果 C# 支持属于不同泛型类型的动态数字或参数(可变参数,params
),那么就不需要 Zip
了。方法,因为它可以被 Select
覆盖.
我不知道这是不是真的,只是解释这句话...
编辑:
我只是认为他的意思是可变数量的泛型类型(实际上只有在与可变数量的方法参数结合使用时才有用),像这样:
void Foo<params T>(params T[] args)
Foo(true, 7, "hello");
想想 Action<...>
的许多声明和 Func<...>
.
顺便说一句,当您不确定某条评论时,为什么不直接问他呢?
关于c# - 通用可变参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4046397/