c# - 在 C# .NET Silverlight 中,如何根据字典中键中的值对字典列表进行排序?

标签 c# .net visual-studio silverlight windows-phone-7

所以我有一个 ListDictionary<string, string> dict我想对 List 进行排序按字母顺序关闭 dict["Title"]值(value)。

我该怎么做?

而且,如果我想取 dict["Title"] 的值怎么办? ,修改为string title = dict["Title"] + "xyz"; , 然后使用修改后的 title作为 dict 的排序值(实际上没有改变 dict["Title"] )...

我该怎么做呢?

谢谢。

最佳答案

链接它:

var dicts = new List<Dictionary<string, string>>();

var sort = dicts.OrderBy(x => x.ContainsKey("Title") ? x["Title"] : string.Empty);
var sort2 = dicts.OrderBy(x => x.ContainsKey("Title") ? x["Title"] + "xyz" : string.Empty);

关于c# - 在 C# .NET Silverlight 中,如何根据字典中键中的值对字典列表进行排序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9627214/

相关文章:

c# - 将泛型隐式转换为包装器

.net - 如何跨多个系统扩展用户界面

.net - ShowDialog 返回类型 : Form vs. 窗口

visual-studio - 完成后从关闭程序停止Visual Studio

c++ - 为什么没有检测到这种缩小转换?

c# - 使用 MySQL 数据库的 C# 数据网格控制

c# - wpf:更改 WebBrowser 控件的字体大小

c# - 使用 exe 编译非托管 DLL

.net - 自定义路由 ASP.NET MVC 在每个 Controller 中设置默认操作

c# - 如何从 Windows Phone 7 应用程序发送电子邮件