5

I was wondering is there an elegant way of geting string[] from List<Tuple<int, int, string>>?

I'm thinking of .NET way (preferable extension methods and lambda expressions :P)

P.S. Code is from .NET 3.5 project, so Tuple is my own implementation.

2 Answers 2

10
var strings = list.Select(item => item.Item3).ToArray();
Sign up to request clarification or add additional context in comments.

Comments

5
string[] s = tuples.Select((t) => t.Value3).ToArray();

(assuming "Value3" is the third value of the tuple)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.