Contain FieldInfo or PropertyInfo and instance to access variable.
More...
Public Member Functions | |
| VariableInfo (string member, Type type, int index=-1) | |
| Initialize with static field or property found by specified member name. More... | |
| VariableInfo (object instance, string member, int index=-1) | |
| Initialize with instance field or property found by specified member name. More... | |
| VariableInfo (MemberInfo member, object instance, int index=-1) | |
Initialize with specified FieldInfo or PropertyInfo. More... | |
| object | GetValue () |
| Get the value this reflects to. More... | |
| void | SetValue (object value) |
| Set the value this reflects to. More... | |
| override string | ToString () |
Return a string of the variable this points to. More... | |
Public Attributes | |
| bool | canRead => null != _valueGetter |
| If able to read the reflected value. More... | |
| bool | canWrite => null != _valueSetter |
| If able to write the reflected value. More... | |
Properties | |
| object | instance [get] |
The instance owns the MemberInfo to access value. More... | |
| MemberInfo | member [get] |
The FieldInfo or PropertyInfo to access value. More... | |
| int | index [get] |
| The element index if reflect to an array element, otherwise -1. More... | |
| Type | valueType [get] |
| The type of reflected value, or array item type if reflects to the element. More... | |
| bool | isStatic [get] |
| Determine if this reflects to static member. More... | |
| bool | isValid [get] |
| If this valid currently. More... | |
Contain FieldInfo or PropertyInfo and instance to access variable.
The main purpose is to access the unknown type value of an UnityEditor.SerializedProperty. Optional to access array element with index in need. Notes, value of an array or array element both belongs to the same member.
| VariableInfo | ( | string | member, |
| Type | type, | ||
| int | index = -1 |
||
| ) |
Initialize with static field or property found by specified member name.
| member | Static field or property name. |
| type | Type owns the member. |
| index | Index to access element, for array only. |
| VariableInfo | ( | object | instance, |
| string | member, | ||
| int | index = -1 |
||
| ) |
Initialize with instance field or property found by specified member name.
Mind that it's a copy if the instance is value type.
| instance | Target instance. |
| member | Instance field or property name. |
| index | Index to access element, for array only. |
| VariableInfo | ( | MemberInfo | member, |
| object | instance, | ||
| int | index = -1 |
||
| ) |
Initialize with specified FieldInfo or PropertyInfo.
Mind that it's a copy if the instance is value type.
| member | Member info. |
| instance | Target instance. |
| index | Index to access element, for array only. |
| object GetValue | ( | ) |
Get the value this reflects to.
| void SetValue | ( | object | value | ) |
Set the value this reflects to.
| value | New value. |
| override string ToString | ( | ) |
Return a string of the variable this points to.
string represents this.| bool canRead => null != _valueGetter |
If able to read the reflected value.
Note, this only determines the reflection without checking valid.
| bool canWrite => null != _valueSetter |
If able to write the reflected value.
Note, this only determines the reflection without checking valid.
|
get |
The instance owns the MemberInfo to access value.
|
get |
The FieldInfo or PropertyInfo to access value.
|
get |
The element index if reflect to an array element, otherwise -1.
|
get |
The type of reflected value, or array item type if reflects to the element.
|
get |
Determine if this reflects to static member.
|
get |
If this valid currently.
Return false in situations below:
null or the index is out of range when reflect to an element.