The C# UnorderedSequence<T> Class

UnorderedSequence<T> represents a sequence field whose elements are accessed by position rather than by key range. It is used for sequence values that are aligned with another ordering sequence or that are processed directly as positional vectors.

For an overview see page C# Classes

Class Definition

    public class UnorderedSequence<T>
    {
        public Sequence Project(Sequence seq);
        public Sequence this[Sequence seq] { get; }

        public void Append(Array items);
        public void Append(Array items, int nItems);
        public void Insert(ulong position, Array items);
        public void Insert(ulong position, Array items, int nItems);
        public void Delete(ulong from, ulong till);

        public ulong Count { get; }
        public Sequence Iterator { get; }
        public Sequence All { get; }

        public static implicit operator Sequence(UnorderedSequence<T> seq);

        public Sequence Subseq(ulong from, ulong till);
        public Sequence Map(Sequence positions);
        public void Store(Sequence iter);
    }

Member Descriptions

UnorderedSequence<T> class
Represents a positional sequence field. Unlike OrderedSequence<T>, it does not provide range search by element value; instead it is typically traversed by position or projected by another sequence iterator.
Schema Declaration
Declare an unordered sequence field with [Sequence()]. In time-series schemas, unordered sequences often store values such as price, volume, or identifiers that are aligned with an ordered key sequence.
Append(Array items)
Appends all items from the supplied array to the end of the sequence. The array element type should match the declared element type T.
Append(Array items, int nItems)
Appends only the first nItems values from the supplied array.
Insert(ulong position, Array items)
Inserts the supplied items starting at the specified position.
Insert(ulong position, Array items, int nItems)
Inserts the first nItems values from the supplied array starting at the specified position.
Delete(ulong from, ulong till)
Deletes the inclusive range of elements from position from through position till.
Count
Gets the number of elements currently stored in the sequence.
Iterator
Returns a Sequence iterator over the entire sequence.
All
Returns a Sequence iterator over the entire sequence. This property is functionally equivalent to Iterator and is convenient in analytical expressions.
implicit operator Sequence
Allows an UnorderedSequence<T> to be used where a Sequence iterator is expected. The implicit conversion yields the full-sequence iterator.
Project(Sequence seq)
Projects this sequence through another sequence iterator, typically one returned by an ordered-sequence search. This is the standard way to select the value interval aligned with a matching key interval.
this[Sequence seq]
Indexer form of Project(). It is commonly used in sequence expressions such as quote.Price[dayIterator].
Subseq(ulong from, ulong till)
Returns a Sequence iterator over the inclusive positional range [from, till].
Map(Sequence positions)
Returns a new Sequence containing elements selected by the positions provided in another iterator. It is typically used with position sequences produced by analytical methods such as top-position or filter-position operations.
Store(Sequence iter)
Stores the values returned by the supplied Sequence iterator back into this sequence field.
Typical Usage
In the common time-series pattern, an ordered sequence such as Day is searched first and the result is then used to project an aligned unordered sequence such as Price or Volume.
Resource Management
UnorderedSequence<T> itself does not implement IDisposable. The Sequence objects returned by its iterator, projection, mapping, and subsequence methods do hold native resources and should be closed or disposed when no longer needed.
Type Parameter T
The generic parameter T indicates the logical element type stored in the sequence, for example float, uint, string, or another supported sequence element type.