Class IntegerPattern
Defines the pattern matching on integer-like values.
public record IntegerPattern : Pattern<object?>, IEquatable<Pattern>, IEquatable<Pattern<object?>>, IEquatable<IntegerPattern>
- Inheritance
-
IntegerPattern
- Implements
- Inherited Members
Constructors
IntegerPattern(IntegerPattern)
protected IntegerPattern(IntegerPattern original)
Parameters
originalIntegerPattern
IntegerPattern(Pattern<long>)
Defines the pattern matching on integer-like values.
public IntegerPattern(Pattern<long> Number)
Parameters
IntegerPattern(long)
Constructs an integer pattern.
public IntegerPattern(long number)
Parameters
numberlongThe expected value.
Fields
AnyInteger
Defines the pattern for any integer.
public static readonly Pattern<object?> AnyInteger
Field Value
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
Number
The pattern describing the expected integer.
public Pattern<long> Number { get; init; }
Property Value
Methods
Deconstruct(out Pattern<long>)
public void Deconstruct(out Pattern<long> Number)
Parameters
Equals(IntegerPattern?)
public virtual bool Equals(IntegerPattern? other)
Parameters
otherIntegerPattern
Returns
Equals(Pattern<object?>?)
public override sealed bool Equals(Pattern<object?>? other)
Parameters
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(object?, MatchingContext)
Attempts to match the provided input to the pattern.
public override IMatchNode<object?>? Match(object? input, MatchingContext context)
Parameters
inputobjectThe input to match.
contextMatchingContextThe context in which to match the pattern to.
Returns
- IMatchNode<object>
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 ==(IntegerPattern?, IntegerPattern?)
public static bool operator ==(IntegerPattern? left, IntegerPattern? right)
Parameters
leftIntegerPatternrightIntegerPattern
Returns
operator !=(IntegerPattern?, IntegerPattern?)
public static bool operator !=(IntegerPattern? left, IntegerPattern? right)
Parameters
leftIntegerPatternrightIntegerPattern