C# 对二维数组中的字段进行排序
我需要按日期时间生日对对象数组的出生集合进行排序 我在想C# 对二维数组中的字段进行排序,c#,sorting,C#,Sorting,我需要按日期时间生日对对象数组的出生集合进行排序 我在想 class Baby { string Name; Birth Birthy; } class Birth { String BirthCity string HospitalName; DateTime Birthday; } 谢谢听起来像是linq的工作 Foreach(Baby...) { Foreach(Birth....) { ...So
class Baby
{
string Name;
Birth Birthy;
}
class Birth
{
String BirthCity
string HospitalName;
DateTime Birthday;
}
谢谢听起来像是linq的工作
Foreach(Baby...)
{
Foreach(Birth....)
{
...Sort(....)
}
}
或者如果你需要对婴儿进行分类
List<Birth> sorted = source.OrderBy(b => b.Birthday).ToList()
对象数组的出生集合-你是什么意思?这个系列看起来像什么?它与Baby有什么关系?你用的是什么语言?C,几乎一个对象集合包含另一个对象集合,在第二个集合中有一个属性日期,我只需要按日期对第二个集合进行排序。你需要按日期对第一个集合中存储的每个集合进行排序吗?不,只有第二个集合
List<Baby> sorted = source.OrderBy(b => b.Birthy.Birthday).ToList()