Show / Hide Table of Contents

Class Ref<T>

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

Inheritance
System.Object
Ref<T>
Implements
System.IComparable<T>
System.IComparable<Ref<T>>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.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
System.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
System.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
System.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.SetPrivateField(Object, String, Object)
ReflectionUtil.GetPrivateField<T>(Object, String)
ReflectionUtil.SetPrivateProperty(Object, String, Object)
ReflectionUtil.InvokePrivateMethod(Object, String, Object[])
ReflectionUtil.InvokePrivateMethod<T>(Object, String, Object[])
  • Improve this Doc
  • View Source
Back to top Generated by DocFX