Class PropertyTableAssigner
Utility class which may be used to set properties on an object from values contained in a Lua table. Properties must be decorated with the MoonSharpPropertyAttribute. See PropertyTableAssigner<T> for a generic compile time type-safe version.
Inheritance
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public class PropertyTableAssigner : IPropertyTableAssigner
Constructors
PropertyTableAssigner(Type, String[])
Initializes a new instance of the PropertyTableAssigner class.
Declaration
public PropertyTableAssigner(Type type, params string[] expectedMissingProperties)
Parameters
|
Type
type
The type of the object. |
|
System.String[]
expectedMissingProperties
The expected missing properties, that is expected fields in the table with no corresponding property in the object. |
Exceptions
|
System.ArgumentException
Type cannot be a value type. |
Methods
AddExpectedMissingProperty(String)
Adds an expected missing property, that is an expected field in the table with no corresponding property in the object.
Declaration
public void AddExpectedMissingProperty(string name)
Parameters
|
System.String
name
The name. |
AssignObject(Object, Table)
Assigns properties from tables to an object.
Declaration
public void AssignObject(object obj, Table data)
Parameters
|
System.Object
obj
The object. |
|
Table
data
The table. |
Exceptions
|
System.ArgumentNullException
Object is null |
|
System.ArgumentException
The object is of an incompatible type. |
|
ScriptRuntimeException
A field does not correspond to any property and that property is not one of the expected missing ones. |
SetSubassignerForType(Type, IPropertyTableAssigner)
Sets the subassigner for the given type. Pass null to remove usage of subassigner for the given type.
Declaration
public void SetSubassignerForType(Type propertyType, IPropertyTableAssigner assigner)
Parameters
|
Type
propertyType
Type of the property for which the subassigner will be used. |
|
IPropertyTableAssigner
assigner
The property assigner. |
Explicit Interface Implementations
IPropertyTableAssigner.AssignObjectUnchecked(Object, Table)
Assigns the properties of the specified object without checking the type.
Declaration
void IPropertyTableAssigner.AssignObjectUnchecked(object obj, Table data)
Parameters
|
System.Object
obj
|
|
Table
data
The data. |