How can you bind a configuration section to an object?

A Configuration section can be bound to a strictly-typed class object in two ways:

  • use Configuration.Bind() by passing the configuration section to bind and the object to which the values are mapped.
  • use services.Configure() to bind a section to a type and access the type by means of IOptions, IOptionsSnapshot or IOptionMonitor interface.