Path
public string Path { get; }The path of the file.
Class in CsvHelper.Linq
The records of a CSV file, to query (as a CsvQuery<T>) and to change: records can be added to the file, and records that match a condition removed or changed, which rewrites the file.
CsvHelper.LinqCsvHelper.Linq.dllpublic string Path { get; }The path of the file.
public CsvQueryOptions QueryOptions { get; }How the file is read and written.
public long AppendRecords(IEnumerable<T> records)Adds records to the end of the file, creating it (with a header) when it does not exist or is empty. They are written with the file's separator and line break, after a line break when the file does not end with one.
recordsIEnumerable<T>records is null.public ValueTask<long> AppendRecordsAsync(IAsyncEnumerable<T> records, CancellationToken cancellationToken = default)Adds an asynchronous sequence of records to the end of the file asynchronously; see AppendRecords.
recordsIAsyncEnumerable<T>cancellationTokenCancellationTokenrecords is null.public ValueTask<long> AppendRecordsAsync(IEnumerable<T> records, CancellationToken cancellationToken = default)Adds records to the end of the file asynchronously; see AppendRecords.
recordsIEnumerable<T>cancellationTokenCancellationTokenrecords is null.public long Delete(Expression<Func<T, bool>> predicate)Removes the records that match a condition from the file, with their line breaks. Everything else is kept byte for byte. The condition reads only the members it uses; a record that cannot be read, and that CsvReaderOptions.OnRecordError skips, is kept. The file is rewritten next to itself and replaced when the new one is complete, so a failure leaves it as it was.
predicateExpression<Func<T, bool>>predicate is null.public ValueTask<long> DeleteAsync(Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default)Removes the records that match a condition from the file, asynchronously; see Delete.
predicateExpression<Func<T, bool>>cancellationTokenCancellationTokenpredicate is null.public long Update(Expression<Func<T, bool>> predicate, Func<T, T> update)Changes the records that match a condition: each is replaced by what update makes of it, in which only the fields whose values changed are written again; the others, the columns that T does not map, and the rest of the file are kept byte for byte. The file is rewritten next to itself and replaced when the new one is complete, so a failure leaves it as it was.
predicateExpression<Func<T, bool>>updateFunc<T, T>o => o with { Status = "Open" }; it may also change the record it gets and return it.predicate or update is null.".public ValueTask<long> UpdateAsync(Expression<Func<T, bool>> predicate, Func<T, T> update, CancellationToken cancellationToken = default)Changes the records that match a condition, asynchronously; see Update.
predicateExpression<Func<T, bool>>updateFunc<T, T>cancellationTokenCancellationTokenpredicate or update is null.".