我有数据表列“数据表中的数据表”ABC/Vesse/11371503/C报告“行2 [主题]列中的列”主题“,行1 [主题]/BEY/11371503/A报告“我需要比较基于/的主题栏内的值,如果/之前的值相同,我应该在下一个斜杠和排序前查找下一个值。”阵列比较和排序列表c#
如上所述,根据/
strSubSplit分割。比较之后,请帮助如何排序并添加到列表中。非常感谢。
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow row in ds.Tables[0].Rows)
{
string strSubject = row["Subject"].ToString();
string strEmailFrom = row["EmailFrom"].ToString();
string strEmailTo = row["EmailTo"].ToString();
string strEmailCC = row["EmailCc"].ToString();
string strEmailContent = row["EmailContent"].ToString();
// Do proper error handling here
DateTime strCreatedOn = DateTime.Parse(row["CreatedOn"].ToString());
string[] strSubSplit= row["Subject"].ToString().Split(new[] {'/'},StringSplitOptions.RemoveEmptyEntries);
mailInfoList.Add(new Tuple<string, string, string, string, string, DateTime>(strSubject, strEmailFrom, strEmailTo, strEmailCC, strEmailContent, strCreatedOn));
var newList = mailInfoList.OrderBy(x => x.Item1).ThenBy(x => x.Item6).ToList();
}
}
请清楚描述你的要求:) –
意思是“ABC/Vesse/11371503/C re端口“是一个列值? –
您的意思是“ABC/Vesse/11371503/C报告”是否按照“11371503/ABC/C report/Vesse”的排序顺序排列? –