IIniSectionFactory<TSection> Interface
Definition
Provides reflection-free conversion between a section type and its INI key/value representation, consumed by the IniSerializer section overloads.
public interface IIniSectionFactory<TSection>
Type Parameters
TSectionThe section type.
- Extension Methods
Remarks
Implementations are typically emitted at compile time by the Bodu.Text.Formats.Generators source generator
for types annotated with IniSectionAttribute, but the interface can equally be implemented by hand
when full control over the key mapping is required. Because no member of this contract inspects types at runtime,
the factory-based serializer paths are safe for trimming and ahead-of-time compilation.
Properties
Keys
Gets the key names of the section type, in declaration order.
IReadOnlyList<string> Keys { get; }
Property Value
- IReadOnlyList<string>
The resolved key names.
Methods
Create(IEnumerable<KeyValuePair<string, string>>)
Creates a section instance from decoded INI entries.
TSection Create(IEnumerable<KeyValuePair<string, string>> entries)
Parameters
entriesIEnumerable<KeyValuePair<string, string>>The section's key/value entries, in source order.
Returns
- TSection
The created section.
GetEntries(TSection)
Converts a section instance to its INI entries, in Keys order.
IEnumerable<KeyValuePair<string, string>> GetEntries(TSection section)
Parameters
sectionTSectionThe section instance.
Returns
- IEnumerable<KeyValuePair<string, string>>
The key/value entries.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |