Class TableFindCursor<T>
- Namespace
- DataStax.AstraDB.DataApi.Core.Enumeration
- Assembly
- DataStax.AstraDB.DataApi.dll
A cursor for finding and enumerating rows in a table. This is a convenience class that uses the same type for both the row and result.
public class TableFindCursor<T> : TableFindCursor<T, T>, IDisposable, IEnumerable<T>, IEnumerable, IAsyncEnumerable<T> where T : class
Type Parameters
TThe type of the rows in the table.
- Inheritance
-
TableFindCursor<T, T>TableFindCursor<T>
- Implements
-
IEnumerable<T>
- Inherited Members
Examples
// Basic usage with foreach
var cursor = table.Find()
.Filter(Builders<MyRow>.TableFilter.Eq(r => r.Status, "active"))
.Sort(Builders<MyRow>.TableSort.Ascending(r => r.Name))
.Limit(10);
foreach (var row in cursor)
{
Console.WriteLine(row.Name);
}
// Async iteration
await foreach (var row in cursor)
{
await ProcessRowAsync(row);
}
Remarks
This cursor is returned by Find(TableFindOptions<T>) and provides a fluent API for filtering, sorting, limiting, and projecting rows. It supports both synchronous and asynchronous iteration patterns.