And*_*996 1 c# linq generics dictionary
我正在用C#编程,并且不断收到错误:“错误CS1061:类型System.Collections.Generic.List<int>' does not contain a definition for长度”,找不到扩展方法Length' of typeSystem.Collections.Generic.List。您是否缺少程序集引用?:
我还添加了使用System.Linq的功能,它可以解决许多类似的问题,但是仍然无法正常工作。
Dictionary<string, int> decryptedPossibilites = new Dictionary<string, int>();
foreach(KeyValuePair<string, int> entry in decryptedPossibilites){
int eCount = entry.Key.Split('E').Length - 1;
eCountList.Add(eCount);
}
int temp = 0;
for (int write = 0; write < eCountList.Length; write++){
for (int sort = 0; sort < eCountList.Length - 1; sort++){
if (eCountList[sort] > eCountList[sort + 1]){
temp = eCountList[sort + 1];
eCountList[sort + 1] = eCountList[sort];
eCountList[sort] = temp;
}
}
}
foreach(int q in eCountList){
Console.WriteLine(q);
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?