有没有一种方法可以对列表列表进行升序排序?

时间:2020-10-25 16:17:53

标签: c# json .net

我有以下列出的列表,可以将其转换为json。

“ {” Calls“:[{” call_id“:91402,” call_info_id“:[112,136,138,150,146,121,131,142,134,139,122,151,130,143,144,141,137,135,128,140,​​132,124,113,127,133,149,145],” call_info_timing_date“” [00:00]“ [00:00]” [第0天:00“ [id_id]:00”;“ -09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2000-04-03T00:00:00“,” 2000-04 -03T00:00:00“,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2020-09-28T10 :40:30“,” 2000-04-03T00:00:00“,” 2020-09-28T10:40:30“,” 2000-04-03T00:00:00“,” 2020-09-28T10:40 :30“,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2000-04-03T00:00:00“,” 2020-09-28T10:40:30 “,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2000-04-03T00:00:00“, “ 2000-04-03T00:00:00”,“ 2020-09-28T10:40:30”,“ 2020-09-28T10:40:30”,“ 2020-09-28T10:40:30”,“ 2020 -09-28T10:40:30“]},{” call_id“:91403,” call_info_id“:[114,116,119,152,120,125,123,147,126,148,115,117],” call_info_timing_id“:11,” dateOfBirth“:[” 2000-04-03T00:00:00“, “ 2020-09-28T10:40:30”,“ 2000-04-03T00:00:00”,“ 2020-09-28T10:40:30 “,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“,” 2020-09-28T10:40:30“, “ 2020-09-28T10:40:30”,“ 2020-09-28T10:40:30”,“ 2000-04-03T00:00:00”,“ 2000-04-03T00:00:00”]}] ,“ StatusCode”:1}“

我的课有以下内容:

 public partial class get_active_call_info_id_Result
    {
        public int call_id { get; set; }
        public int call_info_id { get; set; }
        public int call_info_timing_id { get; set; }
        public System.DateTime dateOfBirth { get; set; }
      
    }

        public partial class get_active_call_info_ids
    {
        public int call_id { get; set; }
        public List<int> call_info_id { get; set; }
        public int call_info_timing_id { get; set; }
        public List<System.DateTime> dateOfBirth { get; set; }
        

        public get_active_call_info_ids()
        {
            call_info_id = new List<int>();
            dateOfBirth = new List<System.DateTime>();
        }
    }

是否有一种方法可以对每个call_info_id中的每个dateOfBirth和相对的call_id进行排序?

1 个答案:

答案 0 :(得分:0)

如何更改您的二传手和getters。

private List<int> _call_info_id;
public List<int> call_info_id 
{ 
    get{
        return _call_info_id.OrderBy(a=>a).ToList();
    }
    set{
        _call_info_id = value;
    }
}