gpt4 book ai didi

c# - 如何在 C# 中执行 Python 的 zip?

转载 作者:太空狗 更新时间:2023-10-29 17:29:56 25 4
gpt4 key购买 nike

Python 的 zip 函数执行以下操作:

a = [1, 2, 3]
b = [6, 7, 8]
zipped = zip(a, b)

结果

[[1, 6], [2, 7], [3, 8]]

最佳答案

this怎么样? ?

C# 4.0 LINQ 的新 ZIP 运算符

public static IEnumerable<TResult> Zip<TFirst, TSecond, TResult>(
this IEnumerable<TFirst> first,
IEnumerable<TSecond> second,
Func<TFirst, TSecond, TResult> func);

关于c# - 如何在 C# 中执行 Python 的 zip?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2427015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com