所有这些代码都可以正常工作。我的问题是消息框中的变量 lTest,如何显示由逗号连接的列表结果。
List<int> lNetworkIds = new List<int>();
Dictionary<DisplayDay, int> numDayOccurances = new Dictionary<DisplayDay, int>();
foreach (Proposal lDetail in this._Proposal.Details)
{
if (!lNetworkIds.Contains(lDetail.NetworkId))
lNetworkIds.Add(lDetail.NetworkId);
if (!numDayOccurances.ContainsKey(lDetail.Day))
numDayOccurances[lDetail.Day] = 0;
numDayOccurances[lDetail.Day]++;
}
if (numDayOccurances.Count > 0)
{
string lTest = "";
foreach (DisplayDay myday in numDayOccurances.Keys)
{
lTest += myday.ToString();
}
MessageBox.Show(lTest);
}