An Dictionary or KeyValuePair without KEY constrain

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,:

List<Tuple<String, String>> people = new List<Tuple<String, String>>();
people.Add(Tuple.Create("Manager", "John Zambers"));
// etc.

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 Name field). For example:

public class Person
   public string Role { get; set; }
   public string Name { get; set; }

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 enum instead. E.g.,

public enum Roles

Need Your Help

Yii Framework with CPanel: Database error when trying to access 'model' generator in gii

php mysql frameworks yii cpanel

I got this error when trying to access 'model' and 'CRUD' generator in gii.

WCF Server/Client connection handling wcf wcf-binding

I'm having some problems with my WCF server and client connections.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.