Structure的List,如何进行排序?

kay338 2016-12-16 09:07:12
定义了学生成绩的一个Structure,又定义了整个班级学生成绩的List,代码如下:
请问listStudent 中如何根据学号进行排序?


Public Structure Student
'学生成绩
Public Number As Integer '学号
Public Name As String '姓名
Public Score() As single '考试成绩
End Structure

Public listStudent As New List(Of Student) '班级成绩

...全文
119 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
kay338 2016-12-16
  • 打赏
  • 举报
回复
引用 4 楼 kay338 的回复:
[quote=引用 3 楼 ajianchina 的回复:] listStudent = listStudent.OrderBy(Function(p) p.Number).ToList()
Dim newList As New List(Of Student) 
newList = listStudent = listStudent.OrderBy(Function(p) p.Number).ToList()
可以了,万分感谢[/quote]
Dim newList As New List(Of Student) 
newList = listStudent.OrderBy(Function(p) p.Number).ToList()
kay338 2016-12-16
  • 打赏
  • 举报
回复
引用 3 楼 ajianchina 的回复:
listStudent = listStudent.OrderBy(Function(p) p.Number).ToList()
Dim newList As New List(Of Student) 
newList = listStudent = listStudent.OrderBy(Function(p) p.Number).ToList()
可以了,万分感谢
ajianchina 2016-12-16
  • 打赏
  • 举报
回复
listStudent = listStudent.OrderBy(Function(p) p.Number).ToList()
kay338 2016-12-16
  • 打赏
  • 举报
回复
引用 1 楼 ajianchina 的回复:

listStudent.OrderBy(Function(p) p.Number)
试过,输出后还是原来的顺序啊?
ajianchina 2016-12-16
  • 打赏
  • 举报
回复

listStudent.OrderBy(Function(p) p.Number)

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧