What is a C#’s analog of std::pair in C++? I found System.Web.UI.Pair class, but I’d prefer something template-based.
What is a C#’s analog of std::pair in C++? I found System.Web.UI.Pair class, but
Share
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.
Tuples are available since .NET4.0 and support generics:
In previous versions you can use
System.Collections.Generic.KeyValuePair<K, V>or a solution like the following:And use it like this:
This outputs:
Or even this chained pairs:
That outputs: