Depending on your needs, you have a few options here.
If you don't need to do key/value lookups and want to stick with a List<>
, you can make use of Tuple<int, string>
:
List<Tuple<int, string>> mylist = new List<Tuple<int, string>>();
// add an item
mylist.Add(new Tuple<int, string>(someInt, someString));
If you do want key/value lookups, you could move towards a Dictionary<int, string>
:
Dictionary<int, string> mydict = new Dictionary<int, string>();
// add an item
mydict.Add(someInt, someString);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…