Question

I have a linq query:

var dataPerDay = (from myRow in eartTideDataTable.AsEnumerable()
                  where myRow.Field<string>(1) == date
                  select myRow);

Simply, I want to change the dataPerDay from var to DataRow[] but I can't do this. I already search in some website but I did not found something match with my case.

I just want to make something like this (see the // marks):

DataRow[] dataPerDay = (from myRow in eartTideDataTable.AsEnumerable()
                        where myRow.Field<string>(1) == date
                        select myRow)//Action Like => .ToDataRow()//;

How to to do this?

Was it helpful?

Solution

Use ToArray()

   DataRow[] dataPerDay = (from myRow in eartTideDataTable.AsEnumerable()
                                where myRow.Field<string>(1) == date
                                select myRow).ToArray();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top