IniSectionAttribute Class
Definition
Marks a partial section POCO for compile-time INI binding: the Bodu.Text.Formats.Generators source generator
emits an IIniSectionFactory<TSection> implementation for the type, exposed through a generated static
IniFactory property.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
public sealed class IniSectionAttribute : Attribute
- Inheritance
-
IniSectionAttribute
- Attributes
-
System.AttributeUsageAttribute
- Inherited Members
- Extension Methods
Remarks
The generated factory maps the public read/write instance properties declared on the type, in declaration order, honoring PropertyNameAttribute for key names and skipping members annotated IgnoreAttribute with Always, the default condition. Scalar values convert with the invariant culture. When writing, the factory leaves out the keys the reflection binder of IniSerializer leaves out under each member's own Condition, and under WhenWritingNull, the default, for a member without one; the factory never sees IniSerializerOptions, so another DefaultIgnoreCondition does not apply to it.
The annotated type must be declared partial so the generator can add the factory to it. Passing the generated factory to the IniSerializer section overloads avoids the reflection binder entirely, making the serialization path trimming- and AOT-safe.
Constructors
IniSectionAttribute()
public IniSectionAttribute()
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |