I need to return a list of two values.
I tried Dictionary but the first parameter is the key and in my case it will repeat.
My list needs to return something like this:
Manager – John Zambers
Developer – Paul Myers
Developer – John Zambers
Tester – Mary Marie
etc… – etc…
I dont want to create my own class to represent this list.
Dot.Net have a built in Type that represent it? Somethink like List()?
Thanks in advance.
You could use the
System.Tuple<T1, T2>class, e.g,:However, what’s wrong with creating your own class? They can be almost self-documenting, especially in a simple case like this (e.g, it’s obvious what’s going to be in the
Namefield). For example:Side note: I don’t know your application domain or what all the possible roles/titles you have, but if you’re doing any sort of processing based on this value it looks like a good place to use an
enuminstead. E.g.,