Compartilhar via


CompoundValue Class

Defines a value type that is suitable for use as an action parameter.

Namespace: Microsoft.Modeling
Assembly: Microsoft.Xrt.Runtime (in Microsoft.Xrt.Runtime.dll)

Usage

'Usage

Syntax

'Declaration
[SerializableAttribute] 
public abstract class CompoundValue

Example

The following C# example defines a Person compound value type. Two persons are considered equal if their names and ages are equal.

class Person : CompoundValue
{
    internal string name;
    internal int age;
    internal Person(string name, int age)
    {
        this.name = name;
        this.age = age;
    }
}

The following Cord example uses the Person class in a domain expression.

config PersonDomain
{
    domain Person =
    {
        Person ( name = "Jane", age = 12 ),
        Person ( name = "John", age = 10 )
    };
}

Remarks

This class overrides the base implementation of the Equals and GetHashCode methods. Two compound value types are considered equal if they are of the same type and are structurally equal, that is all of their fields are equal.

During exploration, Spec Explorer generates an error state for any transition that changes the value of any field of a compound value type. During exploration, Spec Explorer can substitute one instance of a compound value class for another, provided the two instances are structurally equal.

The Map, Sequence, and Set collection classes derive from the CompoundValue class.

Inheritance Hierarchy

System.Object
  Microsoft.Modeling.CompoundValue
     Derived Classes

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Microsoft Windows 7, Microsoft Windows Vista, Microsoft Windows XP SP2 or later, Microsoft Windows Server 2008, Microsoft Windows Server 2003

Change History

See Also

Reference

CompoundValue Members
Microsoft.Modeling Namespace