How can I shorten List>>?

后端 未结 5 1141
醉酒成梦
醉酒成梦 2021-01-19 07:04

I want to store an list of key value pair lists in a lightweight structure. This seems too cumbersome. What\'s better? Does List> add

5条回答
  •  -上瘾入骨i
    2021-01-19 07:36

    Dictionary< string, string> and List< KeyValuePair< string, string>> could both be fine, depending on what data you wanted to pass around. Also, if you are going to use the same long type all over the place you could define the type somewhere else for a shorthand. Something like this:

    public class MyShorthand : List>> { }
    

    Or you can use a using statement to define a type alias like this:

    using MyShorthand = System.Collections.Generic.List>>;
    

提交回复
热议问题