Class DuckTypeAttribute
Definition
Namespace: StardewUI
Assembly: StardewUI.dll
Specifies that a type is eligible for duck-type conversions in data bindings.
Inheritance
Object ⇦ Attribute ⇦ DuckTypeAttribute
Remarks
This attribute is not used by the core library, only the data binding framework. When a type is decorated with it, values of normally non-convertible types, such as user-defined types in a separate mod, can become eligible for conversion to the decorated type and have converters generated at runtime, as long as the external type's properties are sufficient to satisfy one of the decorated type's constructors; or, in the case of default constructors, when the external type can contribute at least one property value.
Duck type conversions always match using the combined property type and (case-insensitive) name. The name of the decorated type's property or constructor argument must match the name of the property on the source type, unless DuckPropertyAttribute is specified, in which case it must match the specified name(s).
Members
Constructors
Name | Description |
---|---|
DuckTypeAttribute() |
Properties
Name | Description |
---|---|
TypeId | (Inherited from Attribute) |
Methods
Name | Description |
---|---|
Equals(Object) | (Inherited from Attribute) |
GetHashCode() | (Inherited from Attribute) |
IsDefaultAttribute() | (Inherited from Attribute) |
Match(Object) | (Inherited from Attribute) |