Share via


Sequence Generic Class

Specifies a Sequence, an ordered collection of elements similar to a list but immutable. See SequenceContainer for a mutable version of sequences.

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

Usage

'Usage

Syntax

'Declaration
[SerializableAttribute] 
[DefaultMemberAttribute("Item")] 
public class Sequence<T> : CompoundValue, ICollection<T>, IEnumerable<T>, 
    IEnumerable

GenericParameters

  • T

Example

[Rule]
static void MyMethod() 
{ 
   Sequence<int> seq = new Sequence(1);
   //The sequence has one element. 
   seq.Add(2); 
   //The sequence still has one element because the result was not stored. 
   seq = seq.Add(2); 
   //Now seq has two elements. 
}

Remarks

Sequence values use an internal representation that is suited for state identification in exploration. Sequence values support most LINQ constructs directly. Sequences can be constructed in Cord expressions using the structured value collection syntax, a list of elements between curly brackets ({}).

Sequence types are immutable, and apparent changes to a sequence create a new instance. The Sequence type obeys value equality in state comparison: two collection values are identical in two states if their content is identical.

Values may reoccur in a Sequence; that is, values are NOT required to be unique.

Inheritance Hierarchy

System.Object
   Microsoft.Modeling.CompoundValue
    Microsoft.Modeling.Sequence
       Microsoft.Modeling.SequenceGroup

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

Sequence Members
Microsoft.Modeling Namespace
SequenceContainer