Struct Result<T>
Represents the result of a completed operation that attempted to create an object of type T.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public struct Result<T> : IEquatable<XRResultStatus>, IEquatable<Result<T>>
Type Parameters
| Name | Description |
|---|---|
| T | The result type. |
Constructors
Result(XRResultStatus, T)
Construct an instance with a given status and value.
Declaration
public Result(XRResultStatus status, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| XRResultStatus | status | The status. |
| T | value | The result value. |
Result(T)
Construct a result containing an unqualified success status code and the given value.
Declaration
public Result(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value. |
Properties
status
The status of the completed operation. You should check whether the operation was successful before you access the result value.
Declaration
public XRResultStatus status { get; }
Property Value
| Type | Description |
|---|---|
| XRResultStatus |
value
The result value of the completed operation. Only valid if status.IsSuccess() is true.
Declaration
public T value { get; }
Property Value
| Type | Description |
|---|---|
| T |
Remarks
Important
If the operation was unsuccessful, you should not access this value. It may be null or could contain default data.
Methods
Equals(object)
Compare for equality with another object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
Equals(Result<T>)
Compare for equality with another instance.
Declaration
public bool Equals(Result<T> other)
Parameters
| Type | Name | Description |
|---|---|---|
| Result<T> | other | The other instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(XRResultStatus)
Compares for equality with an XRResultStatus instance.
Declaration
public bool Equals(XRResultStatus other)
Parameters
| Type | Name | Description |
|---|---|---|
| XRResultStatus | other | The |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
A Result<T> compares equal to an XRResultStatus only if it represents an error, and its
status value is equal to the given XRResultStatus.
GetHashCode()
Get a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | The hash code. |
Overrides
ToString()
Returns a string suitable for debugging purposes.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The string. |