Table of Contents

Class NotNullPattern<T>

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern matching on any non-null instance of the provided type.

public sealed record NotNullPattern<T> : Pattern<T?>, IEquatable<Pattern>, IEquatable<Pattern<T?>>, IEquatable<NotNullPattern<T>>

Type Parameters

T

The type of values to match.

Inheritance
NotNullPattern<T>
Implements
Inherited Members

Constructors

NotNullPattern()

public NotNullPattern()

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

Instance

Gets the singleton instance of the NotNullPattern<T> class.

public static NotNullPattern<T> Instance { get; }

Property Value

NotNullPattern<T>

Methods

Equals(NotNullPattern<T>?)

public bool Equals(NotNullPattern<T>? other)

Parameters

other NotNullPattern<T>

Returns

bool

Equals(Pattern<T?>?)

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

Parameters

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

Attempts to match the provided input to the pattern.

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

Parameters

input T

The input to match.

context MatchingContext

The 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

builder StringBuilder

Returns

bool

Operators

operator ==(NotNullPattern<T>?, NotNullPattern<T>?)

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

Parameters

left NotNullPattern<T>
right NotNullPattern<T>

Returns

bool

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

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

Parameters

left NotNullPattern<T>
right NotNullPattern<T>

Returns

bool