Class AndPattern<T>
Defines a pattern that requires a collection of sub-patterns to be satisfied.
public sealed record AndPattern<T> : Pattern<T>, IEquatable<Pattern>, IEquatable<Pattern<T>>, IEquatable<AndPattern<T>>
Type Parameters
TThe type of value to match.
- Inheritance
-
Pattern<T>AndPattern<T>
- Implements
-
IEquatable<Pattern<T>>IEquatable<AndPattern<T>>
- Inherited Members
Constructors
AndPattern(ImmutableArray<Pattern<T>>)
Defines a pattern that requires a collection of sub-patterns to be satisfied.
public AndPattern(ImmutableArray<Pattern<T>> Operands)
Parameters
OperandsImmutableArray<Pattern<T>>The sub-patterns that all need to be satisfied.
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
Operands
The sub-patterns that all need to be satisfied.
public ImmutableArray<Pattern<T>> Operands { get; init; }
Property Value
Methods
Deconstruct(out ImmutableArray<Pattern<T>>)
public void Deconstruct(out ImmutableArray<Pattern<T>> Operands)
Parameters
OperandsImmutableArray<Pattern<T>>
Equals(AndPattern<T>?)
public bool Equals(AndPattern<T>? other)
Parameters
otherAndPattern<T>
Returns
Equals(Pattern<T>?)
public override sealed bool Equals(Pattern<T>? other)
Parameters
otherPattern<T>
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Format(IndentedTextWriter)
Serializes the pattern to a readable string.
public override void Format(IndentedTextWriter writer)
Parameters
writerIndentedTextWriterThe output stream.
GetHashCode()
public override int GetHashCode()
Returns
Match(T, MatchingContext)
Attempts to match the provided input to the pattern.
public override IMatchNode<T>? Match(T input, MatchingContext context)
Parameters
inputTThe input to match.
contextMatchingContextThe context in which to match the pattern to.
Returns
- IMatchNode<T>
When successful, returns the root node of the match tree, otherwise
null.
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
Operators
operator ==(AndPattern<T>?, AndPattern<T>?)
public static bool operator ==(AndPattern<T>? left, AndPattern<T>? right)
Parameters
leftAndPattern<T>rightAndPattern<T>
Returns
operator !=(AndPattern<T>?, AndPattern<T>?)
public static bool operator !=(AndPattern<T>? left, AndPattern<T>? right)
Parameters
leftAndPattern<T>rightAndPattern<T>