Closed alexeykorsakov closed 3 years ago
Hi,
the ToList
or ToArray
(and friends) will materialize the query. They also show greatly where the boundary between building RavenDB query ends and pure C# LINQ begins. Something that you need to be aware of is that it keeps all the results in the memory, if you are expecting to have many of them, you can always use streaming feature (https://ravendb.net/docs/article-page/5.1/csharp/client-api/session/querying/how-to-stream-query-results)
Hope that this helps.
Fixed the code
foreach (var order in orders) { WriteLine($"{order.Id} - {order.OrderedAt}"); }
Error CS1579 foreach statement cannot operate on variables of type 'IRawDocumentQuery' because 'IRawDocumentQuery' does not contain a public instance or extension definition for 'GetEnumerator'
I can fix it just with
orders.ToList()
What is recommended approach?