How can i convert IQueryable<string> to a string array?

.net, iqueryable, linq

Solution

Try this:

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

This leverages the `Enumerable.ToArray` extension method.

Problem

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`?

Original source