Table of Contents

Class ListPattern<T>

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern matching on a sequence of elements.

public record ListPattern<T> : Pattern<IList<T>>, IEquatable<Pattern>, IEquatable<Pattern<IList<T>>>, IEquatable<ListPattern<T>>

Type Parameters

T

The type of values in the list.

Inheritance
ListPattern<T>
Implements
Inherited Members

Constructors

ListPattern(ListPattern<T>)

protected ListPattern(ListPattern<T> original)

Parameters

original ListPattern<T>

ListPattern(ImmutableArray<Pattern<T>>)

Defines the pattern matching on a sequence of elements.

public ListPattern(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 ListPattern<T> Empty { get; }

Property Value

ListPattern<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(ListPattern<T>?)

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

Parameters

other ListPattern<T>

Returns

bool

Equals(Pattern<IList<T>>?)

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

Parameters

other Pattern<IList<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(IList<T>, MatchingContext)

Attempts to match the provided input to the pattern.

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

Parameters

input IList<T>

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<IList<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 ==(ListPattern<T>?, ListPattern<T>?)

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

Parameters

left ListPattern<T>
right ListPattern<T>

Returns

bool

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

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

Parameters

left ListPattern<T>
right ListPattern<T>

Returns

bool