ElementType
public Type ElementType { get; }The type of the elements, T.
Class in CsvHelper.Linq
A LINQ query over CSV records: its source (CsvQueryable), and the operators applied to it. It runs each time it is enumerated: the CSV reader runs what it can itself (it reads only the members of the records that the query uses, skips rows without parsing them, and filters records before it reads the members that only the rest of the query uses), other LINQ providers run the parts of the query that are theirs, and LINQ to Objects runs the rest.
net10.0, netstandard2.1, netstandard2.0
public class CsvQuery<T> : IOrderedQueryable<T>, IEnumerable<T>, IEnumerable, IOrderedQueryable, IQueryable, IQueryable<T>, ICsvRoot, IAsyncSource<T>net47
public class CsvQuery<T> : IOrderedQueryable<T>, IQueryable<T>, IEnumerable<T>, IEnumerable, IQueryable, IOrderedQueryable, ICsvRoot, IAsyncSource<T>CsvHelper.LinqCsvHelper.Linq.dllAny LINQ operator can be used. CsvQueryable.Explain tells what a query pushes into the reader.
await foreach over a CsvQuery<T> reads the CSV asynchronously (GetAsyncEnumerator); CsvQueryable.AsCsvAsync does the same for the IQueryable<T> that LINQ operators return, and has asynchronous versions of ToList, Count, First and the others. The queries that operators return also implement IAsyncEnumerable<T>, for code that looks for it, such as the ToListAsync of Entity Framework Core. This class does not, so that the LINQ operators of Queryable and of .NET 10's AsyncEnumerable are not both candidates for a query typed as it.
public Type ElementType { get; }The type of the elements, T.
public Expression Expression { get; }The query: a constant holding the source for the query of all its records, else the operators applied to it.
public IQueryProvider Provider { get; }The provider that creates and runs CSV queries.
public CsvQueryPlan Explain()Tells how the query runs without running it: which members of the records it reads, which operators the CSV reader runs, and what it asks other providers for.
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)Runs the query and reads its results as they are enumerated, reading the CSV asynchronously. When the query has operators that the CSV reader does not run itself, the records it reads are buffered first and the rest of the query runs on them; otherwise the results stream.
cancellationTokenCancellationTokenpublic IEnumerator<T> GetEnumerator()Runs the query and reads its results as they are enumerated.
public override string ToString()The query, as text.
file 'orders.csv'.Where(o => (o.Total > 100)).