如何创建一个包含多个变量的SortedList?我想保留(日期,身高,体重)的多个实例。ASP.NET与W#C#SortedList
0
A
回答
3
您需要创建一个包含要存储的字段的类。
class MyVariables {
DateTime BirthDate { get; set; }
double Height { get; set; }
double Weight { get; set; }
}
,然后用它在你的排序列表
var list = new SortedList<string, MyVariables>();
1
您可以创建对象的列表。
public class MyItem
{
public decimal Weight {get;set;}
public decimal Height {get;set;}
public DateTime TheDate {get;set;}
}
List<MyItem> myItems = new List<MyItems>();
var mySortedList = myItems.OrderBy(p => p.Weight);
然后你可以用linq对它进行排序。
+0
有一个名为'SortedList'的类,它是一种字典的混淆。实际上有两个同名的类,一个在System.Collections中,另一个在System.Collections.Generic中。 – 2011-02-27 02:46:18
+0
欢呼塞缪尔,迟到了。 – gdp 2011-02-27 19:21:22
相关问题
- 1. C#Linq SortedList筛选到SortedList
- 2. SortedList与SortedDictionary与Sort()
- 3. ASP.Net Custom Paging(w/C#)
- 4. 来自SortedList的LINQ C#
- 5. RecyclerView与SortedList没有排序
- 6. 如何将SortedList转换为SortedList <>
- 7. C# - 在SortedList中自动生成密钥
- 8. C#SortedList,通过键获取值
- 9. 与SortedList嵌套的RecyclerView不显示
- 10. SortedList DataGridView刷新?
- 11. SortedList和Linq
- 12. 嵌套SortedList
- 13. SortedList移植到Silverlight
- 14. 与NA(W)和NB(W)在语言
- 15. ASP.NET w-s ...从Excel使用?
- 16. Windows Azure的ASP.NET的F/W
- 17. ASP.Net Webforms w/AJAX慢呈现
- 18. asp.net和c#与JavaScript
- 19. 拆分字符串与正则表达式\ w \ w *? \ w +?
- 20. asp.net自定义资源提供使用词典/ SortedList/SortedDictionary?
- 21. 延迟加载SELECT元素选项w/jquerymobile,c#和asp.net
- 22. Android appcompat`SortedList`的度假村?
- 23. 将GridControl绑定到SortedList
- 24. 为什么没有SortedList
- 25. 在SortedList上启用foreach
- 26. ASP.NET w/VB.NET - MultiSelect on ListBox或CheckBoxList w/AutoPostback启用
- 27. asp.net与C#在visual studio 2012
- 28. 消费与asp.net和C webservice#
- 29. 问题与ModalPopup在asp.net/C#
- 30. 绑定gridview与arraylist asp.net/c#
这没什么意义...... – Cosmin 2011-02-27 02:22:55