Class Ref<T>
A class to store a reference for passing to methods which cannot take ref parameters.
Inheritance
Inherited Members
Namespace: IPA.Utilities
Assembly: IPA.Loader.dll
Syntax
public class Ref<T> : IComparable<T>, IComparable<Ref<T>>
Type Parameters
Name | Description |
---|---|
T | the type of the value |
Constructors
| Improve this Doc View SourceRef(T)
Constructor.
Declaration
public Ref(T reference)
Parameters
Type | Name | Description |
---|---|---|
T | reference | the initial value of the reference |
Properties
| Improve this Doc View SourceError
An exception that was generated while creating the value.
Declaration
public Exception Error { get; set; }
Property Value
Type | Description |
---|---|
System.Exception | the error held in this Ref<T> |
Value
The value of the reference
Declaration
public T Value { get; set; }
Property Value
Type | Description |
---|---|
T | the value wrapped by this Ref<T> |
Methods
| Improve this Doc View SourceCompareTo(T)
Compares the wrapped object to the other object.
Declaration
public int CompareTo(T other)
Parameters
Type | Name | Description |
---|---|---|
T | other | the object to compare to |
Returns
Type | Description |
---|---|
System.Int32 | the value of the comparison |
CompareTo(Ref<T>)
Compares the wrapped object to the other wrapped object.
Declaration
public int CompareTo(Ref<T> other)
Parameters
Type | Name | Description |
---|---|---|
Ref<T> | other | the wrapped object to compare to |
Returns
Type | Description |
---|---|
System.Int32 | the value of the comparison |
Verify()
Throws error if one was set.
Declaration
public void Verify()
Operators
| Improve this Doc View SourceImplicit(T to Ref<T>)
Converts a value T to a reference to that object. Will overwrite the reference in the left hand expression if there is one.
Declaration
public static implicit operator Ref<T>(T toConvert)
Parameters
Type | Name | Description |
---|---|---|
T | toConvert | the value to wrap in the Ref |
Returns
Type | Description |
---|---|
Ref<T> | the Ref wrapping the value |
Implicit(Ref<T> to T)
Converts to referenced type, returning the stored reference.
Declaration
public static implicit operator T(Ref<T> self)
Parameters
Type | Name | Description |
---|---|---|
Ref<T> | self | the object to be de-referenced |
Returns
Type | Description |
---|---|
T | the value referenced by the object |