EmailAddressValidatorArrayToDataTable Method |
Converts a string array into
DataTable containing a single column named "email".
Namespace: MailBee.AddressCheckAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public DataTable ArrayToDataTable(
string[] emails
)
Public Function ArrayToDataTable (
emails As String()
) As DataTable
Parameters
- emails
- Type: SystemString
The strings to be put into the resulting data table.
Return Value
Type:
DataTableThe data table containing all the strings from the given array put under the "email" column.
Exceptions Remarks Examples The sample below is actually exerpt from MailBee.NET Objects source code which contains the essential parts of
ArrayToDataTable(String) method. You can use it as a template to copy-paste and edit if you need to populate
DataTable
from other sources (like collections, lists or whatever).
public DataTable ArrayToDataTable(string[] emails)
{
DataTable workTable = new DataTable();
workTable.Columns.Add("email", typeof(string));
foreach (string email in emails)
{
DataRow row = workTable.NewRow();
row["email"] = email;
workTable.Rows.Add(row);
}
return workTable;
}
Public Function ArrayToDataTable(ByVal emails As String()) As DataTable
Dim workTable As New DataTable
workTable.Columns.Add("email", GetType(String))
For Each email As String In emails
Dim row As DataRow = workTable.NewRow()
row("email") = email
workTable.Rows.Add(row)
Next
Return workTable
End Function
See Also