Class FlagsPattern<T>
Defines the pattern for bitmasks.
public record FlagsPattern<T> : Pattern<T>, IEquatable<Pattern>, IEquatable<Pattern<T>>, IEquatable<FlagsPattern<T>> where T : Enum, IConvertible
Type Parameters
TThe type of bit mask
- Inheritance
-
Pattern<T>FlagsPattern<T>
- Implements
-
IEquatable<Pattern<T>>
- Inherited Members
Constructors
FlagsPattern(FlagsPattern<T>)
protected FlagsPattern(FlagsPattern<T> original)
Parameters
originalFlagsPattern<T>
FlagsPattern(T, T)
Defines the pattern for bitmasks.
public FlagsPattern(T ExpectedValue, T Mask)
Parameters
ExpectedValueTThe expected bit flags.
MaskTThe flags that should be tested within the bitmask.
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
ExpectedValue
The expected bit flags.
public T ExpectedValue { get; init; }
Property Value
- T
Mask
The flags that should be tested within the bitmask.
public T Mask { get; init; }
Property Value
- T
Methods
Deconstruct(out T, out T)
public void Deconstruct(out T ExpectedValue, out T Mask)
Parameters
ExpectedValueTMaskT
Equals(FlagsPattern<T>?)
public virtual bool Equals(FlagsPattern<T>? other)
Parameters
otherFlagsPattern<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 ==(FlagsPattern<T>?, FlagsPattern<T>?)
public static bool operator ==(FlagsPattern<T>? left, FlagsPattern<T>? right)
Parameters
leftFlagsPattern<T>rightFlagsPattern<T>
Returns
operator !=(FlagsPattern<T>?, FlagsPattern<T>?)
public static bool operator !=(FlagsPattern<T>? left, FlagsPattern<T>? right)
Parameters
leftFlagsPattern<T>rightFlagsPattern<T>