Class NullPattern<T>
Defines the pattern matching on null instances of the provided type.
public sealed record NullPattern<T> : Pattern<T?>, IEquatable<Pattern>, IEquatable<Pattern<T?>>, IEquatable<NullPattern<T>>
Type Parameters
TThe type of values to match.
- Inheritance
-
Pattern<T>NullPattern<T>
- Implements
-
IEquatable<Pattern<T>>
- Inherited Members
Constructors
NullPattern()
public NullPattern()
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
Instance
Gets the singleton instance of the NullPattern<T> class.
public static NullPattern<T> Instance { get; }
Property Value
- NullPattern<T>
Methods
Equals(NullPattern<T>?)
public bool Equals(NullPattern<T>? other)
Parameters
otherNullPattern<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 ==(NullPattern<T>?, NullPattern<T>?)
public static bool operator ==(NullPattern<T>? left, NullPattern<T>? right)
Parameters
leftNullPattern<T>rightNullPattern<T>
Returns
operator !=(NullPattern<T>?, NullPattern<T>?)
public static bool operator !=(NullPattern<T>? left, NullPattern<T>? right)
Parameters
leftNullPattern<T>rightNullPattern<T>