Method TryGetSection
- Namespace
- PaintDotNet.FileTypes
- Assembly
- PaintDotNet.FileTypes.dll
TryGetSection<TSection>(IReadOnlyFileTypeMetadata, FileTypeMetadataSectionKind, out TSection?)
Tries to get a read-only metadata section by its FileTypeMetadataSectionKind.
public static bool TryGetSection<TSection>(this IReadOnlyFileTypeMetadata metadata, FileTypeMetadataSectionKind sectionKind, out TSection? section) where TSection : class, IReadOnlyFileTypeMetadataSection
Parameters
metadataIReadOnlyFileTypeMetadataThe metadata instance.
sectionKindFileTypeMetadataSectionKindThe kind of metadata section to get.
sectionTSectionWhen this method returns, contains the metadata section if found; otherwise,
null.
Returns
- bool
trueif a matching section was found; otherwise,false.
Type Parameters
TSectionThe metadata section interface type.
Exceptions
- InterfaceNotSupportedException
Thrown if there's a mismatch between
sectionKindandTSection. For example, ifsectionKindis Exif andTSectionistypeof(IReadOnlyFileTypeXmpMetadata).