有一个元组数组和对象列表定义为:
Tuple<string, string, string>[] phone_type
List<Tele> telecomm
public class Tele
{ public string number;
public string displayNumber;
public string type;
}
Run Code Online (Sandbox Code Playgroud)
我想将元素中存在的值分配给List<Tele>
元组数组.以下代码不起作用.
obj.phone_type[0] = (Tuple<string,string,string>) obj1.telecommunication[0];
Run Code Online (Sandbox Code Playgroud)
错误说cast是多余的,无法转换List
为Tuple<string,string,string>
是否有一种干净的方法将List的特定/所有元素分配给元组数组.