110,534
社区成员
发帖
与我相关
我的任务
分享
string[] tableArray = query.tablestr.Split(',');
Dictionary<string, int> Lengths = new Dictionary<string, int>();
for (int n = 0; n < tableArray.Length - 1; n++)
{
for (int u = 0; u < TableLengths.Count; u++)
{
if (TableLengths[u].Name == tableArray[n])
{
Lengths.Add(TableLengths[u].Name, TableLengths[u].Length);
}
}
}
var list = (from d in Lengths orderby d.Value ascending select d).ToList();//排序
//我现在要对list进行插入操作
//请问怎么在list中插入<string, int>这种类型的元素啊
for (var i = 0; i < list.Count; i++)
{
switch (list[i].Key)
{
case "PRO_Verticalstretch_end":
list.Insert(i, new KeyValuePair<string, int>("ss",5));
break;
default:
break;
}
}
Dictionary<string, int> Lengths = new Dictionary<string, int>();
Lengths.Add("a", 1);
Lengths.Add("b", 2);
Lengths.Add("c", 3);
var list = (from d in Lengths orderby d.Value ascending select d).ToList();
list.Add(new KeyValuePair<string, int>("d", 4));