How to store multiple items in IDictionary?

前端 未结 1 492
说谎
说谎 2021-01-29 10:25

I have this IDictionary declaration: IDictionary trace;
Inside of it I want save a list of element returned by a json deseri

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-29 10:58

    Looks like you'd be better off using a dedicated class, something like this:

    public class TraceInfo
    {
        public string Date { get; set; }
        public string Type { get; set; }
        public List ContextItems { get; set; }
    }
    

    Then for every value in obj, create a TraceInfo object using new TraceInfo() and set its properties.

    You can then store them in a List or in a Dictionary, the choice is yours.

    0 讨论(0)
提交回复
热议问题