Class FieldInstance
A FieldInstance is a class that wraps a FieldInfo and a reference. It can be seen as the representation on a field on one particular object instance. This enables an easy serialization / deserialization mechanism through dictionnaries. Dictionnaries are great as they allow to store multiple levels of data and structures such as structs, classes, arrays, or base types. Unity is bad at serializing multiple levels of data and doesn't handles polymorphism. Dictionnaries also fix thoses issues.
Inheritance
System.Object
FieldInstance
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: PiXYZ.Tools
Assembly: cs.temp.dll.dll
Syntax
public sealed class FieldInstance
Constructors
FieldInstance(FieldInfo, Object)
Declaration
public FieldInstance(FieldInfo fieldInfo, object reference)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo | |
System.Object | reference |
FieldInstance(FieldInfo, Object, MethodInfo, MethodInfo)
Declaration
public FieldInstance(FieldInfo fieldInfo, object reference, MethodInfo visibilityCheck, MethodInfo enablingCheck)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo | |
System.Object | reference | |
MethodInfo | visibilityCheck | |
MethodInfo | enablingCheck |
FieldInstance(FieldInfo, Object, String, String, String, String)
Declaration
public FieldInstance(FieldInfo fieldInfo, object reference, string visibilityCheck = null, string enablingCheck = null, string tooltip = null, string displayName = null)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo | |
System.Object | reference | |
System.String | visibilityCheck | |
System.String | enablingCheck | |
System.String | tooltip | |
System.String | displayName |
Fields
enablingCheck
Declaration
public readonly MethodInfo enablingCheck
Field Value
Type | Description |
---|---|
MethodInfo |
fieldInfo
Declaration
public readonly FieldInfo fieldInfo
Field Value
Type | Description |
---|---|
FieldInfo |
name
Declaration
public readonly string name
Field Value
Type | Description |
---|---|
System.String |
reference
Declaration
public readonly object reference
Field Value
Type | Description |
---|---|
System.Object |
tooltip
Declaration
public readonly string tooltip
Field Value
Type | Description |
---|---|
System.String |
visibilityCheck
Declaration
public readonly MethodInfo visibilityCheck
Field Value
Type | Description |
---|---|
MethodInfo |
Properties
type
Returns the field type
Declaration
public Type type { get; }
Property Value
Type | Description |
---|---|
System.Type |
value
Returns the instance value
Declaration
public object value { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
deserializeData(Dictionary<String, String>)
Unloads the data of the given dictionnary into the object field instance
Declaration
public void deserializeData(Dictionary<string, string> pairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | pairs |
serializeData(ref Dictionary<String, String>)
Fills the referenced dictionnary with serialized data (recursively if the type is complex)
Declaration
public void serializeData(ref Dictionary<string, string> pairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | pairs |