Table of Contents

Class ReadOnlyListPattern<T>

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern matching on a sequence of elements.

public record ReadOnlyListPattern<T> : Pattern<IReadOnlyList<T>>, IEquatable<Pattern>, IEquatable<Pattern<IReadOnlyList<T>>>, IEquatable<ReadOnlyListPattern<T>>

Type Parameters

T

The type of values in the list.

Inheritance
ReadOnlyListPattern<T>
Implements
Inherited Members

Constructors

ReadOnlyListPattern(ReadOnlyListPattern<T>)

protected ReadOnlyListPattern(ReadOnlyListPattern<T> original)

Parameters

original ReadOnlyListPattern<T>

ReadOnlyListPattern(ImmutableArray<Pattern<T>>)

Defines the pattern matching on a sequence of elements.

public ReadOnlyListPattern(ImmutableArray<Pattern<T>> Elements)

Parameters

Elements ImmutableArray<Pattern<T>>

The elements in the sequence.

Properties

Elements

The elements in the sequence.

public ImmutableArray<Pattern<T>> Elements { get; init; }

Property Value

ImmutableArray<Pattern<T>>

Empty

Gets the singleton instance of the ReadOnlyListPattern<T>.

public static ReadOnlyListPattern<T> Empty { get; }

Property Value

ReadOnlyListPattern<T>

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

Methods

Deconstruct(out ImmutableArray<Pattern<T>>)

public void Deconstruct(out ImmutableArray<Pattern<T>> Elements)

Parameters

Elements ImmutableArray<Pattern<T>>

Equals(Pattern<IReadOnlyList<T>>?)

public override sealed bool Equals(Pattern<IReadOnlyList<T>>? other)

Parameters

other Pattern<IReadOnlyList<T>>

Returns

bool

Equals(ReadOnlyListPattern<T>?)

public virtual bool Equals(ReadOnlyListPattern<T>? other)

Parameters

other ReadOnlyListPattern<T>

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Format(IndentedTextWriter)

Serializes the pattern to a readable string.

public override void Format(IndentedTextWriter writer)

Parameters

writer IndentedTextWriter

The output stream.

GetHashCode()

public override int GetHashCode()

Returns

int

Match(IReadOnlyList<T>, MatchingContext)

Attempts to match the provided input to the pattern.

public override IMatchNode<IReadOnlyList<T>>? Match(IReadOnlyList<T> input, MatchingContext context)

Parameters

input IReadOnlyList<T>

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<IReadOnlyList<T>>

When successful, returns the root node of the match tree, otherwise null.

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Operators

operator ==(ReadOnlyListPattern<T>?, ReadOnlyListPattern<T>?)

public static bool operator ==(ReadOnlyListPattern<T>? left, ReadOnlyListPattern<T>? right)

Parameters

left ReadOnlyListPattern<T>
right ReadOnlyListPattern<T>

Returns

bool

operator !=(ReadOnlyListPattern<T>?, ReadOnlyListPattern<T>?)

public static bool operator !=(ReadOnlyListPattern<T>? left, ReadOnlyListPattern<T>? right)

Parameters

left ReadOnlyListPattern<T>
right ReadOnlyListPattern<T>

Returns

bool