Skip to content

Configurations

kevin-montrose edited this page Jan 15, 2020 · 6 revisions

Configurations

Introduction

Cesil distinguishes between Options and configurations:

  • A set of Options describes the format being read or written
  • A configuration binds a set of Options to a type

Cesil supports binding to static types, and binding to .NET's dynamic (a "static dynamic type").

Once bound, a configuration is responsible for creating readers and writers. Cesil represents a bound configuration with the IBoundConfiguration<T> interface.

Creating Configurations

All methods for creating IBoundConfiguration<T> are on Configuration.

To bind to a static type T call Configuration.For<T>() (to use Options.Default for Options), or call Configuration.For<T>(Options) (to use custom Options).

To bind to dynamic call Configuration.ForDynamic() (to use Options.DynamicDefault for Options), or call Configuration.ForDynamic(Options) (to use custom Options).

Thread Safety

All of the members of Configuration are thread safe, as are the members on the returned IBoundConfiguration<T> instances.

Clone this wiki locally