I'm looking for the ideal collection to use in my current situation.
All I need is a List<string> which can allow two entries for each index. Similar to a Dictionary, however I do not need keys and values, and would like to iterate through it by index. The best collection I can think of is a multi-dimension array, however I would like to specify that two items can be stored in each element, however the amount of elements can be infinite.
Which collection should I use?
EDIT: Also, I thought of using a List<List<string>>, however since I only need two elements for each index, I think storing a list in each index position of the list would be a waste.
You can use Tuple
Check this: Tuple (Class)
var population = new Tuple<string, string>("New York", "Madrid");
Try use a class
public class MyData
{
public string Data1 {get;set;}
public string Data2 {get;set;}
}
var obj = List<MyData>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With