Method GetSection
- Namespace
- PaintDotNet.FileTypes
- Assembly
- PaintDotNet.FileTypes.dll
GetSection(IReadOnlyFileTypeMetadata, FileTypeMetadataSectionKind)
Gets a read-only metadata section by its FileTypeMetadataSectionKind.
public static IReadOnlyFileTypeMetadataSection GetSection(this IReadOnlyFileTypeMetadata metadata, FileTypeMetadataSectionKind sectionKind)
Parameters
metadataIReadOnlyFileTypeMetadataThe metadata instance.
sectionKindFileTypeMetadataSectionKindThe kind of metadata section to get.
Returns
- IReadOnlyFileTypeMetadataSection
The metadata section.
Exceptions
- KeyNotFoundException
Thrown if
metadatadoes not contain a metadata section of the given kind.
GetSection<TSection>(IReadOnlyFileTypeMetadata, FileTypeMetadataSectionKind)
Gets a read-only metadata section by its FileTypeMetadataSectionKind.
public static TSection GetSection<TSection>(this IReadOnlyFileTypeMetadata metadata, FileTypeMetadataSectionKind sectionKind) where TSection : class, IReadOnlyFileTypeMetadataSection
Parameters
metadataIReadOnlyFileTypeMetadataThe metadata instance.
sectionKindFileTypeMetadataSectionKindThe kind of metadata section to get.
Returns
- TSection
The metadata section.
Type Parameters
TSectionThe metadata section interface type.
Exceptions
- KeyNotFoundException
Thrown if
metadatadoes not contain a metadata section of the given kind.- InterfaceNotSupportedException
Thrown if there's a mismatch between
sectionKindandTSection. For example, ifsectionKindis Exif andTSectionistypeof(IReadOnlyFileTypeXmpMetadata).