将数据集转换为List(字符串) [英] Convert dataset to List(of string)

查看:130
本文介绍了将数据集转换为List(字符串)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将数据集转换为列表(字符串)?



代码:

How to convert dataset to list(of string)?

Code:

Dim name As String
      name = dsMatter.Tables(0).Rows(0).Item("FirstName")



它试图将代码更改为:


It tried to change the code to:

Dim name As String
      name = dsMatter.Tables(0).Rows(0).Item("FirstName").Tolist



但是没有用..你可以帮帮我吗?


But is not working.. Can you please help me with this?

推荐答案





看一下 Visual Basic中的LINQ简介 [ ^ ]



然后你可以通过这样的方式转换为字符串列表:

Hi,

Have a look at an Introduction to LINQ in Visual Basic[^]

Then you can convert to a list of strings, by doing something like this:
Dim sList As List(Of String) = dsMatter.Tables(0).AsEnumerable().[Select](Function(r) r.Field(Of String)("FirstName")).ToList()





...希望它有所帮助。



... hope it helps.


这篇关于将数据集转换为List(字符串)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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