How can I shorten List>>?

后端 未结 5 1148
醉酒成梦
醉酒成梦 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条回答
  •  囚心锁ツ
    2021-01-19 07:51

    For clarity I would wrap your KeyValuePair into something shorter, e.g. StringPair and also define a shorthand for a list of StringPair. This will shorten your syntax and help readability IMHO.

    public class StringPair : KeyValuePair { }
    
    public class StringPairList : List { }
    
    ..
    
    
    var jaggedList = new List();
    

提交回复
热议问题