DotNetObject.GetField

Query the value of a field

WTSupported in traditional Synergy on Windows

 

 

 

object.GetField(fieldname, value)

or

value = object.GetField(fieldname)

Arguments

object

An object returned by the DotNetAssembly constructor, the DotNetObject constructor, or some other property or method that returns an object

fieldname

The name of the field to query.

value

Returned with the coerced value for the field.

Discussion

If object is an object returned from the DotNetAssembly constructor, only static fields can be accessed using the namespace.class.field form of fieldname. Fieldname must be a public or public static field defined for the specified object; otherwise, an $ERR_MISSFLD error occurs.

If a structfield member is to be accessed, object will be the object of the structfield returned by DotNetObject.GetField.

If a field is defined more than once using different value types, the default binder is used to attempt to locate the best fit for the parameter passed. If no match is found, an $ERR_MISSFLD error will occur.

If the first GetField syntax above is used (returning the value in a writable argument), the system attempts to coerce parameters from .NET types using the same rules as DotNetObject.GetProperty.

If the second GetField syntax is used, the value is coerced following the rules in the Objects Returned for .NET Types table.

Examples

The example below queries the value of an instance field.

obj = obj.GetField("instanceField")

The example below queries the value of an instance field with no boxing.

obj.GetField("instanceField", obj)

The following example queries the value of a static field.

obj = asmObj.GetField("namespace.classname.StaticField")