更新时间:2023-10-13 19:44:46
不要使用2个数组.
您***的方法是使用一个类来存储数据对.
Your best approach is to use a class to store pairs of data.
public class Student
{
public string Name { get; set; }
public int Mark { get; set; }
}
一旦您有一个学生对象数组
Once you have an array of Student objects
List<Student> students = new List<Student>();
students.Add(...);
然后您可以将名称与标记一起排序
Then you can sort the names together with the marks
var sortedStudents = students.OrderBy(s => s.Mark).ToList();