C#
Code: Select all
DataTable db = GetCustomers("ACCTINFO.dbf");
string[] postSource = db
.AsEnumerable()
.Select<System.Data.DataRow, String>(x => x.Field<String>("ACTNUMBER"))
.ToArray();
X#
Code: Select all
local db := GetCustomers("ACCTINFO.dbf"as DataTable
local postSource as string[]
postSource := db:AsEnumerable():select<DataRow, string>( {x => x:Field<string>("ACTNUMBER")}):ToArray() // I prefer this syntax
/*
// alternate syntax with ; as line continuation character ( I am not talking C#)
postSource := db:AsEnumerable();
:select<System.Data.DataRow, string>( {x => x:Field<string>("ACTNUMBER")});
:ToArray()
*/
Code: Select all
{x => x:Field<string>("ACTNUMBER")}
x is of type DataRow which is implicit, but may be strongly typed as:
Code: Select all
{x as DataRow => x:Field<string>("ACTNUMBER")}
Jamal