Table of Contents

Method TryGetSection

Namespace
PaintDotNet.FileTypes
Assembly
PaintDotNet.FileTypes.dll

TryGetSection<TSection>(IFileTypeMetadata, FileTypeMetadataSectionKind, out TSection?)

Tries to get a mutable metadata section by its FileTypeMetadataSectionKind.

public static bool TryGetSection<TSection>(this IFileTypeMetadata metadata, FileTypeMetadataSectionKind sectionKind, out TSection? section) where TSection : class, IFileTypeMetadataSection

Parameters

metadata IFileTypeMetadata

The metadata instance.

sectionKind FileTypeMetadataSectionKind

The kind of metadata section to get.

section TSection

When this method returns, contains the metadata section if found; otherwise, null.

Returns

bool

true if a matching section was found; otherwise, false.

Type Parameters

TSection

The metadata section interface type.

Exceptions

InterfaceNotSupportedException

Thrown if there's a mismatch between sectionKind and TSection. For example, if sectionKind is Exif and TSection is typeof(IFileTypeXmpMetadata).