有没有一种将 Tuple 转换为 ValueTuple 的简写方法?

Jam*_*s B 3 .net tuples c#-7.0 valuetuple

我刚刚将 DLL 文件包含到我的项目中,并使用返回List<Tuple>. 我最近才意识到ValueTupleC# 7 中的数据类型,并想使用它来代替返回的普通元组。我知道我可以循环并手动进行转换,但是我想尽可能避免这样做,并且想知道是否有人知道将 Tuple 转换为 ValueTuple 的简写方法?如果我无知并且这是不可能的,那么如果有人能让我意识到实现这种转换的最有效方法,我将不胜感激。

我寻找了一种.ToValueTuple()方法,并在返回列表的函数上使用了基本的转换,但没有任何乐趣。

尝试时:

List<(string entityName, int min, int average, int max)> tupTest = trs.GetEntityStats();
Run Code Online (Sandbox Code Playgroud)

我收到错误:

无法将源类型“System.Collections.Generic.List>”转换为目标类型“System.Collections.Generic.List<(string entityName, int min, intaverage, int max)>”

Pau*_*ado 7

TupleExtensions 类具有和ToTuple方法ToValueTuple