DataTable dt = new DataTable();
string str;
string[] s = Array.ConvertAll<DataRow, string>(dt.Select(), delegate(DataRow row)
{
return (string)row[""];
});
str = String.Join(",", s);
答案 0 :(得分:0)
您是否正在寻找以下内容:
Dim dt As DataTable = New DataTable()
Dim str As String
Dim s As String() = Array.ConvertAll(Of DataRow, String)(dt.Select(), Function(row As DataRow) DirectCast(row(""), String))
str = String.Join(",", s)
如果是VB 8.0 (.Net 2.0)
,则不支持匿名方法。要解决此问题,请使用以下代码:
Dim dt As DataTable = New DataTable()
Dim str As String
Dim s As String() = Array.ConvertAll(Of DataRow, String)(dt.Select(), AddressOf ConvertRowToString)
str = String.Join(",", s)
ConvertRowToString
功能:
Function ConvertRowToString(ByVal row As DataRow) As String
Return DirectCast(row(""), String)
End Function