Show / Hide Table of Contents

# Class Ref<T>

A class to store a reference for passing to methods which cannot take ref parameters.

##### Inheritance

Object
Ref<T>

##### Implements

IComparable<T>
IComparable<Ref<T>>

##### Inherited Members

Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

###### 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 Source

#### Ref(T)

Constructor.

##### Declaration

    public Ref(T reference)

##### Parameters

Type | Name | Description
--- | --- | ---
T | reference | the initial value of the reference

### Properties

| Improve this Doc View Source

#### Error

An exception that was generated while creating the value.

##### Declaration

    public Exception Error { get; set; }

##### Property Value

Type | Description
--- | ---
Exception | the error held in this Ref<T>

| Improve this Doc View Source

#### 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 Source

#### CompareTo(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
--- | ---
Int32 | the value of the comparison

| Improve this Doc View Source

#### 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
--- | ---
Int32 | the value of the comparison

| Improve this Doc View Source

#### Verify()

Throws error if one was set.

##### Declaration

    public void Verify()

### Operators

| Improve this Doc View Source

#### Implicit(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

| Improve this Doc View Source

#### 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

### Implements

System.IComparable<T>
System.IComparable<T>

### Extension Methods

ReflectionUtil.SetField(Object, String, Object)
ReflectionUtil.SetField<T>(T, String, Object)
ReflectionUtil.GetField<T>(Object, String)
ReflectionUtil.SetProperty(Object, String, Object)
ReflectionUtil.SetProperty<T>(T, String, Object)
ReflectionUtil.InvokeMethod(Object, String, Object[])
ReflectionUtil.InvokeMethod<T>(T, String, Object[])
ReflectionUtil.InvokeMethod<T>(Object, String, Object[])
ReflectionUtil.InvokeMethod<T, U>(U, String, Object[])