Share via

StateFilterAttribute Class

Indicates that parameterless method or property is a state filter.

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




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


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>
        static bool JobCountBound
            get { return JobBound == 0 || jobs.Count <= JobBound; }




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


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.


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


StateFilterAttribute Members
Microsoft.Modeling Namespace

Other Resources

State Attributes