PolyToolkit.PolyStatusOr< T >

A union of a PolyStatus and a type.

Summary

Used to represent the result of an operation, which can either be an error (represented as a PolyStatus), or a result object (the parameter type T).

Details
Template Parameters
T
The result object.

Properties

Ok
bool
Shortcut to Status.ok.
Status
Returns the status.
Value
T
Returns the value.

Public functions

PolyStatusOr(PolyStatus status)
Creates a PolyStatusOr with the given error status.
PolyStatusOr(T value)
Creates a PolyStatusOr with the given value.
ToString()
override string

Properties

Ok

bool Ok

Shortcut to Status.ok.

Status

PolyStatus Status

Returns the status.

Value

T Value

Returns the value.

The value can only be obtained if the status is successful. If the status is an error, reading this property will throw an exception.

Public functions

PolyStatusOr

 PolyStatusOr(
  PolyStatus status
)

Creates a PolyStatusOr with the given error status.

Details
Parameters
status
The error status with which to create it.

PolyStatusOr

 PolyStatusOr(
  T value
)

Creates a PolyStatusOr with the given value.

The status will be set to success.

Details
Parameters
value
The value with which to create it.

ToString

override string ToString()