API reference
API reference
Select your platform
No SDKs available
No versions available

OVRResult Class

Extends IEquatable< OVRResult< TStatus > >, IEquatable< OVRResult< TValue, TStatus > >
Represents a result with a status code of type TStatus .
Represents a result with a value of type TValue and a status code of type TStatus .
Others
TStatus
The type of the status code. It must have the OVRResultStatus attribute
The OVRResult<TStatus> struct provides a wrapper around a status code and exposes properties for success and status retrieval.
Others
TValue
The type of the value.
TStatus
The type of the status code.
An OVRResult<TValue,TStatus> represents the result of an operation which may fail. If the operation succeeds (Success is True), then you can access the value using the Value property.
If it fails (Success is False), then the OVRResult does not have a value, and it is an error to access the Value property. In this case, the Status property will contain an error code.

Properties

Gets a bool indicating whether the result is a success.
Gets the status of the result.
Gets a bool indicating whether the result has a value.
The value of the result.
It is an error to access this property unless Success is True. See also TryGetValue.
Exceptions
InvalidOperationException
Thrown if Success is False.

Static Member Functions

static OVRResult< TStatus > From< TStatus >
( TStatus status )
static OVRResult< TResult, TStatus > From< TResult, TStatus >
( TResult result,
TStatus status )
Creates a new OVRResult<TValue, TStatus> with the specified status.
Parameters
status
The status.
Returns
A new OVRResult<TValue, TStatus> with the specified status.
Creates a new OVRResult<TValue, TStatus> with the specified success status.
Parameters
status
The status (must be a valid success status).
Returns
A new OVRResult<TValue, TStatus> with the specified status.
Exceptions
ArgumentException
Thrown when status is not a valid success status.
See Also
Creates a new OVRResult<TValue, TStatus> with the specified failure status.
Parameters
status
The status (must be a valid failure status).
Returns
A new OVRResult<TValue, TStatus> with the specified status.
Exceptions
ArgumentException
Thrown when status is not a valid failure status.
See Also
Creates a new OVRResult<TValue, TStatus> with the specified value and status.
Parameters
value
The value.
status
The status.
Returns
A new OVRResult<TValue, TStatus> with the specified value and status.
Creates a new OVRResult<TValue, TStatus> with the specified value and a success status.
Parameters
value
The value.
status
The status (must be a valid success status).
Returns
A new OVRResult<TValue, TStatus> with the specified value and status.
Exceptions
ArgumentException
Thrown when status is not a valid success status.
See Also
Creates a new OVRResult<TValue, TStatus> with the specified failure status.
Parameters
status
The status (must be a valid failure status).
Returns
A new OVRResult<TValue, TStatus> with the specified status.
Exceptions
ArgumentException
Thrown when status is not a valid failure status.
See Also

Member Functions

Determines whether the current OVRResult<TStatus> is equal to another OVRResult<TStatus>.
Parameters
other
The OVRResult<TStatus> to compare with the current one.
Returns
true if the specified OVRResult<TStatus> is equal to the current OVRResult<TStatus>; otherwise, false.
Determines whether the current OVRResult<TStatus> is equal to another object.
Parameters
obj
The object to compare with the current OVRResult<TStatus>.
Returns
true if the specified object is equal to the current OVRResult<TStatus>; otherwise, false.
Gets a hashcode suitable for use in a Dictionary or HashSet.
Returns
A hashcode for this result.
Generates a string representation of this result object.
The string representation is the stringification of Status, or "(invalid result)" if this result object has not been initialized.
Returns
A string representation of this OVRResult<TStatus>
Tries to retrieve the value of the result.
Parameters
value
When this method returns, contains the value of the result if the result was successful; otherwise, the default value.
Returns
true if the result was successful and the value is retrieved; otherwise, false.
See Also
Determines whether the current OVRResult<TValue, TStatus> is equal to another OVRResult<TValue, TStatus>.
Parameters
other
The OVRResult<TValue, TStatus> to compare with the current one.
Returns
true if the specified OVRResult<TValue, TStatus> is equal to the current OVRResult<TValue, TStatus>; otherwise, false.
Determines whether the current OVRResult<TValue, TStatus> is equal to another object.
Parameters
obj
The object to compare with the current OVRResult<TValue, TStatus>.
Returns
true if the specified object is equal to the current OVRResult<TValue, TStatus>; otherwise, false.
override bool TStatus other && Equals
( other )
Gets a hashcode suitable for use in a Dictionary or HashSet.
Returns
A hashcode for this result.
Generates a string representation of this result object.
If this result object has not been initialized, the string is "(invalid result)". Otherwise, if Success is True, then the string is the stringification of the Status and Value. If Success is False, then it is just the stringification of Status.
Returns
A string representation of this OVRResult<TStatus>
Did you find this page helpful?
Thumbs up icon
Thumbs down icon