First, AFAIK, there isn't any list that takes two type parameters - so your List could either be a List<int>
or List<string>
(or a SortedList<int,string>
, but that's a different class).
A Tuple<T1, T2>
holds two values - one int and one string in this case. You can use a Tuple to bind together items (that might be of different
types). This may be useful in many situations, like, for instance, you want to return more than one value from a method.
I personally hate the Item1
, Item2
property names, so I would probably use a wrapper class around Tuples in my code.
A Dictionary<TKey, TValue>
is a collection of KeyValuePair<TKey, TValue>
. A Dictionary maps keys to values, so that you can have, for instance, a dictionary of people and for each person have their SSN as a key.
A List<T>
is a collection of T
.
You can get individual items by using the index, the Find
method, or simply LINQ (since it implements IEnumerable<T>
).