Show / Hide Table of Contents

Class FastAccess

A helper class for fast access to getters and setters

Inheritance
System.Object
FastAccess
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: HarmonyLib
Assembly: 0Harmony.dll
Syntax
public static class FastAccess

Methods

| Improve this Doc View Source

CreateFieldGetter<T, S>(String[])

Creates an getter delegate for a field (with a list of possible field names)

Declaration
[Obsolete("Use AccessTools.FieldRefAccess<T, S>(name) for fields and AccessTools.MethodDelegate<Func<T, S>>(AccessTools.PropertyGetter(typeof(T), name)) for properties")]
public static GetterHandler<T, S> CreateFieldGetter<T, S>(params string[] names)
Parameters
Type Name Description
System.String[] names

A list of possible field names

Returns
Type Description
GetterHandler<T, S>

The new getter delegate

Type Parameters
Name Description
T

Type that getter reads field/property from

S

Type of the field/property that gets accessed

| Improve this Doc View Source

CreateGetterHandler<T, S>(FieldInfo)

Creates an getter delegate for a field

Declaration
[Obsolete("Use AccessTools.FieldRefAccess<T, S>(fieldInfo)")]
public static GetterHandler<T, S> CreateGetterHandler<T, S>(FieldInfo fieldInfo)
Parameters
Type Name Description
System.Reflection.FieldInfo fieldInfo

The field

Returns
Type Description
GetterHandler<T, S>

The new getter delegate

Type Parameters
Name Description
T

Type that getter reads field from

S

Type of the field that gets accessed

| Improve this Doc View Source

CreateGetterHandler<T, S>(PropertyInfo)

Creates an getter delegate for a property

Declaration
[Obsolete("Use AccessTools.MethodDelegate<Func<T, S>>(PropertyInfo.GetGetMethod(true))")]
public static GetterHandler<T, S> CreateGetterHandler<T, S>(PropertyInfo propertyInfo)
Parameters
Type Name Description
System.Reflection.PropertyInfo propertyInfo

The property

Returns
Type Description
GetterHandler<T, S>

The new getter delegate

Type Parameters
Name Description
T

Type that getter reads property from

S

Type of the property that gets accessed

| Improve this Doc View Source

CreateInstantiationHandler<T>()

Creates an instantiation delegate

Declaration
public static InstantiationHandler<T> CreateInstantiationHandler<T>()
Returns
Type Description
InstantiationHandler<T>

The new instantiation delegate

Type Parameters
Name Description
T

Type that constructor creates

| Improve this Doc View Source

CreateSetterHandler<T, S>(FieldInfo)

Creates an setter delegate for a field

Declaration
[Obsolete("Use AccessTools.FieldRefAccess<T, S>(fieldInfo)")]
public static SetterHandler<T, S> CreateSetterHandler<T, S>(FieldInfo fieldInfo)
Parameters
Type Name Description
System.Reflection.FieldInfo fieldInfo

The field

Returns
Type Description
SetterHandler<T, S>

The new getter delegate

Type Parameters
Name Description
T

Type that setter assigns field value to

S

Type of the field that gets assigned

| Improve this Doc View Source

CreateSetterHandler<T, S>(PropertyInfo)

Creates an setter delegate

Declaration
[Obsolete("Use AccessTools.MethodDelegate<Action<T, S>>(PropertyInfo.GetSetMethod(true))")]
public static SetterHandler<T, S> CreateSetterHandler<T, S>(PropertyInfo propertyInfo)
Parameters
Type Name Description
System.Reflection.PropertyInfo propertyInfo

The property

Returns
Type Description
SetterHandler<T, S>

The new setter delegate

Type Parameters
Name Description
T

Type that setter assigns property value to

S

Type of the property that gets assigned

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX