NET 11 introduces ConfigurationIgnoreAttribute in Microsoft.Extensions.Configuration, filling a long-standing gap where there was no official way to prevent the configuration binder from populating a specific property. Previously, developers had to use a hacky workaround with ConfigurationKeyNameAttribute and a garbage key name. The new attribute is simple to use — just decorate any property you want excluded from binding. Common use cases include computed/derived properties and parsed representations of raw config values. Note that JsonIgnoreAttribute has no effect on the configuration binder and cannot be used as a substitute.

2m read timeFrom steven-giesel.com
Post cover image
Table of contents
The ProblemThe Fix: ConfigurationIgnoreAttributeAnother Common ScenarioCan't I Just Use [JsonIgnore] ?GitHub

Sort: