我有數據表列「數據表中的數據表」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」的排序順序排列? –