This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Assignment Compatibility
The constraints in the type signature and the location signature affect assignment compatibility of a value to a location. Assignment compatibility of a value (described by a type signature) to a location (described by a location signature) is defined as follows:
- One of the types supported by the exact type of the value is the same as the type in the location signature. This allows, for example, an instance of a class that inherits from a base class (hence supports the base class’s type contract) to be stored into a location whose type is that of the base class.
- A value that has the constant constraint in its type signature can only be stored in a location that also has the constant constraint in its location signature.
- The reverse is not true. A location signature that includes the constant constraint is compatible with a type signature that does not include the constant constraint.
Note: V1 does not support the constant constraint