I want to use a Tuple but in C# 2, it does not exist. I think to replace it by KeyValuePair.
Is it the best way to do this ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A simple class holding two generic members is probably the best option. This is essentially what
Tuple<T1,T2>is.If you know the types you are using, it is better to create a class with members of those types – this way you can use good naming for the class and members to ensure good readability (which a generic type like
Tupleobscures).From you comment, I would suggest that creating a small wrapper class (or possibly struct) to hold the
intvalues will be the best choice.Untested: