Table of Contents

Interface ITypeCast<TDestination>

Namespace
LfrlAnvil.Functional
Assembly
LfrlAnvil.Functional.dll

Represents a type-erased result of a type cast.

public interface ITypeCast<out TDestination> : IReadOnlyCollection<TDestination>, IEnumerable<TDestination>, IEnumerable

Type Parameters

TDestination

Destination type.

Inherited Members
Extension Methods

Properties

IsInvalid

Specifies whether or not this type cast is invalid.

bool IsInvalid { get; }

Property Value

bool

IsValid

Specifies whether or not this type cast is valid.

bool IsValid { get; }

Property Value

bool

Source

Underlying source object.

object? Source { get; }

Property Value

object

Methods

GetResult()

Gets the underlying type cast result.

[Pure]
TDestination GetResult()

Returns

TDestination

Underlying type cast result.

Exceptions

ValueAccessException

When underlying type cast result does not exist.

GetResultOrDefault()

Gets the underlying type cast result or a default value when it does not exist.

[Pure]
TDestination? GetResultOrDefault()

Returns

TDestination

Underlying type cast result or a default value when it does not exist.