Skip to content

Commit

Permalink
Added indexer for immutable sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
YohDeadfall committed Apr 24, 2023
1 parent d46a0f2 commit 9e51d17
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion WabiSabi/Collections/ImmutableValueSequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace WabiSabi.Collections;
/// it can be compared with other sequences and the equality of two sequences is based on the
/// equality of the elements.
/// </summary>
public readonly struct ImmutableValueSequence<T> : IReadOnlyCollection<T>, IEquatable<ImmutableValueSequence<T>> where T : IEquatable<T>
public readonly struct ImmutableValueSequence<T> : IReadOnlyList<T>, IEquatable<ImmutableValueSequence<T>> where T : IEquatable<T>
{
private readonly ImmutableArray<T> _elements;

Expand All @@ -19,6 +19,8 @@ public ImmutableValueSequence(IEnumerable<T> sequence)

public static ImmutableValueSequence<T> Empty { get; } = new();

public T this[int index] => _elements[index];

public int Count => _elements.Length;

public ImmutableArray<T>.Enumerator GetEnumerator() => _elements.GetEnumerator();
Expand Down

0 comments on commit 9e51d17

Please sign in to comment.