Click or drag to resize

TryCastWorkerTValue, TResult Class

Inheritance Hierarchy
SystemObject
  TomsToolbox.CoreTryCastWorkerBaseTValue, TResult
    TomsToolbox.CoreTryCastWorkerTValue, TResult

Namespace:  TomsToolbox.Core
Assembly:  TomsToolbox.Core (in TomsToolbox.Core.dll) Version: 1.0.70.0
Syntax
public class TryCastWorker<TValue, TResult> : TryCastWorkerBase<TValue, TResult>

Type Parameters

TValue
The type of the value.
TResult
The type of the result.

The TryCastWorkerTValue, TResult type exposes the following members.

Properties
Methods
  NameDescription
Public methodElse
Executes the action and returns the result if no previous cast has succeeded.

[CanBeNull]

Public methodElseThrow
Throws an InvalidOperationException if none of the casts have succeeded.

[CanBeNull]

(Inherited from TryCastWorkerBaseTValue, TResult.)
Public methodElseThrow(String)
Throws an InvalidOperationException if none of the casts have succeeded.

[CanBeNull]

(Inherited from TryCastWorkerBaseTValue, TResult.)
Protected methodTryExecuteTTarget
Tries to cast the value and executes the action if the cast was successful.
(Inherited from TryCastWorkerBaseTValue, TResult.)
Public methodWhenTTarget
Tries to cast the value to TTarget; if the cast succeeds, the action is executed and the result is stored in the Result property.

[NotNull]

Top
Extension Methods
  NameDescription
Public Extension MethodSafeCastT
Performs a cast from object to T, avoiding possible null violations if T is a value type.

[CanBeNull]

(Defined by ObjectExtensions.)
Top
See Also