Domanda

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?

È stato utile?

Soluzione

Use ToArray()

   DataRow[] dataPerDay = (from myRow in eartTideDataTable.AsEnumerable()
                                where myRow.Field<string>(1) == date
                                select myRow).ToArray();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top