Namespace Cesil

Classes

AheadOfTimeTypeDescriber

An ITypeDescriber that use (de)serializer that was generated ahead of time by using Cesil.SourceGenerator.

CesilUtils

A collection of convenience methods for reading and writing using streams or files.

These methods are less flexible than directly using Configuration and are not as efficient as using IReader(T), IAsyncReader(T), IWriter(T) and IAsyncWriter(T), but they involve much less code.

Prefer them when the trade off for simplicity at the expense speed and flexibility makes sense.

ColumnIdentifier

Identifies a particular column, either by index or index and name.

A ColumnIdentifier is only valid for as long as the values used to construct it. Accordingly, you should be careful when storing ColumnIdentifiers that you did not create yourself as they may have been created with ReadOnlyMemory(char)s whose lifetime you do not control.

Configuration

Used to combine a type and an Options into an IBoundConfiguration(T), which can create readers and writers.

ConstructorInstanceProviderAttribute

Automatically attached to generated methods depending on runtime behavior.

You should not use this directly.

DefaultTypeDescriber

The default implementation of ITypeDescriber used to determine how to (de)serialize types and how to convert dynamic cells and rows.

It will serialize all public properties, any fields with a [DataMember], and will respect ShouldSerialize() methods.

It will deserialize all public properties, any fields with a [DataMember], and will call Reset() methods. Expects a public parameterless constructor for any deserialized types.

It will also deserialize records using their primary constructor. Names, Parsers, Resets, and Order may be customized with records but not Setters and MemberRequireds.

It will convert dynamic cells to most built-in types, and map dynamoc rows to POCOs, ValueTuples, Tuples, and IEnumerables.

This type is unsealed to allow for easy extension of it's behavior.

DeserializableMember

Represents a member of a type to use when deserializing.

DeserializerInstanceProviderAttribute

When using Cesil's Source Generator (see Nuget.org for Cesil.SourceGenerator) marks a constructor as the InstanceProvider for the containing type.

To use a method instead of a constructor, use the InstanceProviderType and InstanceProviderMethodName properties on [GenerateDeserializableAttribute].

DeserializerMemberAttribute

Attach this attribute to a method, field, property, or parameter to expose it as deserializable and configure it's "Parser", "MemberRequired", "Reset", and "Order" behaviors.

If attached to a property, the propery must have a setter and take no parameters.

If attached to a method it must return void.

If attached to a parameter, the parameter must be to a constructor, all parameters to the constructor must also be annotated, and the constructor itself must be annotated with DeserializerInstanceProviderAttribute.

If attached to a static method it may:

  • take 1 parameter (the result of the parser) or
  • take 2 parameters, the result of the parser and an in ReadContext or
  • take 2 parameters, the row type (which may be passed by ref), and the result of the parser or
  • take 3 parameters, the row type (which may be passed by ref), the result of the parser, and in ReadContext

If attached to an instance method it may:

  • be on the row type, and take 1 parameter (the result of the parser) or
  • be on the row type, and take 2 parameters, the result of the parser and an in ReadContext

DoesNotEmitDefaultValueAttribute

Automatically attached to generated methods depending on runtime behavior.

You should not use this directly.

DynamicCellValue

Wrapper around a dynamic cell which is to be written by an I(Async)Writer.

DynamicRowConverter

Describes how to convert a dynamic row value into an instance of a type.

Conversions can implemented as constructors taking a single dynamic/object, constructors taking typed parameters, an empty constructor paired with setter methods, or static methods.

DynamicRowConverterDelegate<TOutput>

Delegate type for DynamicRowConverters.

DynamicRowDisposal

When a dynamic row returned by a IReader or IAsyncReader will be disposed.

EmitDefaultValue

Whether or not the default value for a member will be serialized.

ExtraColumnTreatment

How to handle extra columns when reading a row.

A column is "extra" is if it's index is beyond those found in the header (or first row, if no header is present) of the CSV being read.

Formatter

Represents code used to format a value into a IBufferWriter(char).

Wraps either a static method or a delegate.

FormatterDelegate<TValue>

Delegate type for formatters.

GenerateDeserializerAttribute

When using Cesil's Source Generator (see Nuget.org for Cesil.SourceGenerator) marks a class or struct as needing a deserializer generated at compile time.

InstanceProviderType and InstanceProviderMethodName are used to indicate how to obtain an instance of the annotated type from a method. If not set, the type's parameterless constructor is used by default. To use a constructor other than the parameterless, use the [DeserializerInstanceProvider].

When using the AheadOfTimeTypeDescriber, the created I(Async)Readers for this type will do no runtime code generation.

You can customize the behavior of the generated deserializer with [DataMemberAttribute], and [DeserializaerMemberAttribute] attributes.

Default behavior (with no additional attributes) closely follows DefaultTypeDescriver.

GeneratedSourceVersionAttribute

Automatically attached to generated types to track compatibility.

You should not use this directly.

GeneratedSourceVersionAttribute.GeneratedTypeKind

Used by GeneratedSourceVersionAttribute.

You should not use this directly.

GenerateSerializerAttribute

When using Cesil's Source Generator (see Nuget.org for Cesil.SourceGenerator) marks a class or struct as needing a serializer generated at compile time.

When using the AheadOfTimeTypeDescriber, the created I(Async)Writers for this type will do no runtime code generation.

You can customize the behavior of the generated serialize with [DataMemberAttribute], and [SerializerMemberAttribute] attributes.

Default behavior (with no additional attributes) closely follows DefaultTypeDescriver.

Getter

Represents code used to get a value from a type.

Wraps a static method, an instance method, a field, or a delegate.

GetterDelegate<TRow, TValue>

Delegate type for getters.

ImpossibleException

An exception that should never happen.

If it does, that indicates a bug in Cesil. Kindly report it on https://github.com/kevin-montrose/Cesil/issues/new.

InstanceProvider

Represents a way to obtain an instance of a type.

This can be backed by a zero-parameter constructor, a constructor taking typed parameters, a static method, or a delegate.

InstanceProviderDelegate<TInstance>

Delegate used to create InstanceProviders.

IsRequiredAttribute

Automatically attached to generated methods depending on runtime behavior.

You should not use this directly.

ManualTypeDescriber

An ITypeDescriber that takes lets you register explicit members to return when one of the EnumerateXXX() methods are called.

ManualTypeDescriberBuilder

Builder for creating a ManualTypeDescriber.

Creates ITypeDescribers explicitly registered members to return when one of the EnumerateXXX() methods are called.

ManualTypeDescriberFallbackBehavior

How to behave if a ManualTypeDescriber needs to describe a type that isn't explicitly configured.

MemberRequired

Whether or not a member is required during deserialization.

MemoryPoolProviders

Holds references to pre-allocated IMemoryPoolProviders.

Options

A set of options for reading and writing CSV files.

Combine with Configuration to bind to a particular type in a IBoundConfiguration(T) which can create readers and writers.

OptionsBuilder

Builder for Options.

Options itself is immutable, but OptionsBuilder is chainable and mutable.

Parser

Represents code used to parse values into concrete types.

Wraps a static method, a constructor taking a single ReadOnlySpan(char), a constuctor taking a ReadOnlySpan(char) and a ReadContext, or a delegate.

ParserDelegate<TOutput>

Delegate type for parsers.

ReadContext

Context object provided during read operations.

ReadContextMode

Indicates what a reader is doing when a ReadContext is created.

ReadHeader

Whether to expect a header row when deserializing.

This can be determined automatically with Detect.

ReadResult<TRow>

Represents the result of an attempted read operation.

ReadRowEnding

Which character sequence will end a row when reading rows.

This can be determined automatically with Detect.

ReadWithCommentResult<TRow>

Represents the result of an attempted read operation which supports comments.

ReadWithCommentResultType

Represents the type of a ReadWithCommentResult, either no value (end of records), having a value (of type T), or having a comment (always a string).

Reset

Represents code called before a setter is called or a field is set.

Wraps a static method, an instance method, or a delegate.

ResetByRefDelegate<TRow>

Delegate type for resets, where row is passed by ref.

ResetDelegate<TRow>

Delegate type for resets.

SerializableMember

Represents a member of a type to use when serializing.

SerializerMemberAttribute

Attach this attribute to a method, field, or property to expose it as serializable and configure it's "ShouldSerialize", "Formatter", "Order", and "EmitDefaultValue" behaviors.

If attached to a property, the propery must have a getter and take no parameters.

If attached to a method, the method must return a non-null value and either:

  • be an instance method and
  • take no parameters
  • take one parameter, an in WriteContext
  • be static and
  • take no parameters
  • take one parameter either
  • an in WriteContext or
  • a type to which the declaring type of this member can be assigned
  • take two parameters
  1. a type to which the declaring type of this member can be assigned
  2. in WriteContext

Setter

Represents code used to set parsed values onto types.

Wraps a static method, an instance method, a delegate, a field, or a constructor parameter.

SetterBackedByConstructorParameterAttribute

Automatically attached to generated methods depending on runtime behavior.

You should not use this directly.

SetterBackedByInitOnlyPropertyAttribute

Automatically attached to generated methods depending on runtime behavior.

You should not use this directly.

SetterByRefDelegate<TRow, TValue>

Delegate type for setters, where instance is passed by ref.

SetterDelegate<TRow, TValue>

Delegate type for setters.

ShouldSerialize

Represents code used to determine whether or not to write a value.

Wraps a static method, an instance method, or a delegate.

ShouldSerializeDelegate<TRow>

Delegate type for 'should serialize'.

StaticGetterDelegate<TValue>

Delegate type for getters that doesn't take a row.

StaticResetDelegate

Delegate type for resets that don't take an instance of the row.

StaticSetterDelegate<TValue>

Delegate type for setters that don't take an instance.

StaticShouldSerializeDelegate

Delegate type for 'should serialize' that don't take a row.

SurrogateTypeDescriber

A ITypeDesciber that enumerates members on a surrogate type and maps them to another type.

Used when you don't control the type you need to (de)serialize - you markup the surrogate type and then the uncontrolled type is (de)serialized as if it were the surrogate type.

SurrogateTypeDescriberBuilder

Builder for creating a SurrogateTypeDescriber.

Creates ITypeDescribers that inspects one type to determine who to (de)serialize another type.

Used when you don't control the type you need to (de)serialize - you markup the surrogate type and then the uncontrolled type is (de)serialized as if it were the surrogate type.

SurrogateTypeDescriberFallbackBehavior

How to behave if a SurrogateTypeDescriber needs to describe a type that isn't explicitly configured.

TypeDescribers

Holds references to pre-allocated TypeDescibers.

WhitespaceTreatments

How to handle whitespace when encountered during parsing.

Allows for automatic removal of leading or trailing whitespace in or outside of values or headers, depending on whether in an escaped sequence.

WriteContext

Context object provided during write operations.

WriteContextMode

Indicates what a writer is doing when a WriteContext is created.

WriteHeader

Whether or not to write a header row when serializing.

WriteRowEnding

Which character sequence will end a row when writing rows.

Unlike with ReadRowEnding, this cannot be inferred.

WriteTrailingRowEnding

Whether or not their should be a trailing row ending after the last row when serializing.

Interfaces

IAsyncReader<TRow>

Interface for an asynchronous reader.

IAsyncWriter<TRow>

Interface for writing rows asynchronously.

IBoundConfiguration<TRow>

Represents and Options and Type pair.

Used to create readers and writers.

IMemoryPoolProvider

Interface used to obtain MemoryPools.

Cesil uses this during creation of IBoundConfigurations to determine where necessary allocations during read/writing will be placed.

IReader<TRow>

Interface for a synchronous reader.

ITypeDescriber

The interface used to discover the members to (de)serialize for a type.

DefaultTypeDescriber, ManualTypeDescriber, and SurrogateTypeDescriber all implement this interface and handle the most common desired configurations.

Note to implementors: All ITypeDescriber methods must be thread safe, as they are invoked as needed during operation with no guarantee about the calling thread(s).

IWriter<TRow>

Interface for synchronously writing rows.

In This Article
  • Classes
  • Interfaces
Back to top Generated by DocFX