如何在列表中列出一个列表? [英] How do I have a list within a list?
问题描述
 
//没有语法错误:
&NBSP; &NBSP; &NBSP; var lstPartsQtyPerDate = new List< Tuple< string,string,string,string,string []>>();
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP;列表与LT;串GT; lstDates = new List< string>();
//为什么元组不允许lstDates以及如何修复?
lstPartsQtyPerDate.Add(new Tuple< string,string,string,string,string []>(strPartNum,strPO,arrstrThreeParts [1],strShipTo,lstDates));
元组变量是四个字符串和一个工作正常的字符串列表
&NBSP;
//没有语法错误:
&NBSP; &NBSP; &NBSP; var lstPartsQtyPerDate = new List< Tuple< string,string,string,string,string []>>();
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP;列表与LT;串GT; lstDates = new List< string>();
//为什么元组不允许lstDates以及如何修复?
lstPartsQtyPerDate.Add(new Tuple< string,string,string,string,string []>(strPartNum,strPO,arrstrThreeParts [1],strShipTo,lstDates));
首先要突出的是第五个参数采用字符串
数组,而非List。
- Wayne
//No syntax errors:
var lstPartsQtyPerDate = new List<Tuple<string, string, string, string, string[]>>();
List<string> lstDates = new List<string>();
//Why does the tuple not allow lstDates and how do I fix it?
lstPartsQtyPerDate.Add(new Tuple<string, string, string, string, string[]>(strPartNum, strPO, arrstrThreeParts[1], strShipTo, lstDates));The tuple variables are four strings and a list of strings that work just fine
//No syntax errors:
var lstPartsQtyPerDate = new List<Tuple<string, string, string, string, string[]>>();
List<string> lstDates = new List<string>();
//Why does the tuple not allow lstDates and how do I fix it?
lstPartsQtyPerDate.Add(new Tuple<string, string, string, string, string[]>(strPartNum, strPO, arrstrThreeParts[1], strShipTo, lstDates));
The first thing that stands out is that the fifth parameter takes a string
array, not a List.
- Wayne
这篇关于如何在列表中列出一个列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!