views:

832

answers:

2

Hi,

if I do this...

rowNames = _myDB.RowSet.Where(r => (r.RowId >= minId) && (r.RowId <= maxId))
                                                      .Select(r => r.RowName);

it returns an IQueryable, how can I put this into: string[] myStringArray?

+6  A: 

Try this:

_myDB.RowSet
    .Where(r => (r.RowId >= minId) && (r.RowId <= maxId))
    .Select(r => r.RowName)
    .ToArray();

This leverages the Enumerable.ToArray extension method.

Andrew Hare
There is no try, only do.
bzlm
+3  A: 

.ToArray()

Larsenal