MediaTagResult<T> Struct

Represents the result of a media tag operation that returns a value of type T.

public readonly struct MediaTagResult<T>

Type parameters

T
The type of the result value.

Remarks

The default value of this type is a failure carrying MediaTagError.UnsupportedFormat, so MediaTagResult<T>.Error is never null when MediaTagResult<T>.IsSuccess is false.

Properties

NameDescription
ErrorGets the error that occurred, or null if the operation succeeded.
ErrorMessageGets a human-readable error message, if the operation failed.
IsSuccessGets a value indicating whether the operation succeeded.
ValueGets the result value. Throws if the operation failed.

Gets the error that occurred, or null if the operation succeeded.

public MediaTagError? Error { get; }

Property value

MediaTagError?

ErrorMessage

MediaTagResult.cs

Gets a human-readable error message, if the operation failed.

public string? ErrorMessage { get; }

Property value

string?

Gets a value indicating whether the operation succeeded.

public bool IsSuccess { get; }

Property value

bool

Gets the result value. Throws if the operation failed.

public T Value { get; }

Property value

T

Methods

NameDescription
Failure(MediaTagError, string?)Creates a failure result with the specified error.
Success(T)Creates a successful result with the specified value.

Failure(MediaTagError, string?)

MediaTagResult.cs

Creates a failure result with the specified error.

public static MediaTagResult<T> Failure(MediaTagError error, string? message = null)

Parameters

error MediaTagError
message string?

Returns

MediaTagResult<T>

Creates a successful result with the specified value.

public static MediaTagResult<T> Success(T value)

Parameters

value T

Returns

MediaTagResult<T>