如何从List< Tuple< int,int,string>>获取字符串数组? [英] How to get array of string from List<Tuple<int, int, string>>?

查看:152
本文介绍了如何从List< Tuple< int,int,string>>获取字符串数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否存在一种从 List< Tuple< int,int,string>> 的优雅方式 string [] code>?



我在想.NET方法(最好的扩展方法和lambda表达式:P)

PS代码来自.NET 3.5项目,所以Tuple是我自己的实现。

解决方案

  var strings = list.Select(item => item.Item3).ToArray(); 


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.

解决方案

var strings = list.Select(item => item.Item3).ToArray();

这篇关于如何从List&lt; Tuple&lt; int,int,string&gt;&gt;获取字符串数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆