StateFilterAttribute Class

Indicates that parameterless method or property is a state filter.

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

Usage

'Usage

Syntax

'Declaration
[AttributeUsageAttribute(AttributeTargets.Method|AttributeTargets.Property, AllowMultiple=false, Inherited=false)] 
public sealed class StateFilterAttribute : Attribute

Example

The following example shows usage of the StateFilter attribute.

namespace ATSvc.Model
{
    public static class ModelProgram
    {

        
        /// <summary>
        /// A filter on states. Filters out states where job count exceeds the bound.
        /// </summary>
        [StateFilter]
        static bool JobCountBound
        {
            get { return JobBound == 0 || jobs.Count <= JobBound; }
        }

        

    }
}

Remarks

A state filter is a Boolean condition causing states to be excluded from exploration. The StateFilter attribute indicates that its Boolean target property, field, or parameterless method is a state filter.

A value of TRUE indicates that the annotated method or property is evaluated in a given state; FALSE indicates exclusion from exploration.

If the target of a StateFilter is a method, it can be static or instance-based. If it is instance-based, the state filter is said to hold if the return value is TRUE for all reachable instances of the type. The return type of the method MUST be System.Boolean.

For more information about using attributes, see Extending Metadata Using Attributes.

Inheritance Hierarchy

System.Object
   System.Attribute
    Microsoft.Modeling.StateFilterAttribute

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

StateFilterAttribute Members
Microsoft.Modeling Namespace

Other Resources

State Attributes