How can i convert IQueryable<string> to a string array?
-
22-07-2019 - |
Question
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
?
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.
OTHER TIPS
.ToArray()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow