Sort two Lists together as one?

前端 未结 7 2074
执笔经年
执笔经年 2020-12-07 01:30

I have two List which I am accessing by index (e.g. Name[10], Date[10]). They\'re closely tied, so Name[10] is related to Date[1

7条回答
  •  星月不相逢
    2020-12-07 01:58

    List NameDateList {get; set; }
    

    Is an easy way to accomplish what you want, but for clarity you are probably better off making a custom type to house them such as:

    public class NameDate
    {
        public string Name { get; set; }
        public DateTime Date{ get; set; }
    }
    

    Then you could use:

    List NameDateList {get; set; }
    

提交回复
热议问题