Class EventSpec

Namespace
AsmLocator
Assembly
AsmLocator.dll

Describes constraints used to match an event definition.

public sealed record EventSpec : IEquatable<EventSpec>
Inheritance
EventSpec
Implements
Inherited Members

Constructors

EventSpec()

public EventSpec()

Properties

Attribute

The custom attribute type full-name matcher.

public StringMatcher? Attribute { get; init; }

Property Value

StringMatcher

EventType

The event type full-name matcher.

public StringMatcher? EventType { get; init; }

Property Value

StringMatcher

Name

The member name matcher. When null, the name is not used as a constraint.

public StringMatcher? Name { get; init; }

Property Value

StringMatcher

Where

An optional custom predicate applied after the built-in constraints.

public Func<EventDefinition, bool>? Where { get; init; }

Property Value

Func<EventDefinition, bool>

Methods

ByName(StringMatcher)

Creates a specification constrained by member name.

public static EventSpec ByName(StringMatcher name)

Parameters

name StringMatcher

The name matcher for the target member.

Returns

EventSpec

A new specification with the described constraints.

Equals(EventSpec?)

public bool Equals(EventSpec? other)

Parameters

other EventSpec

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Matches(EventDefinition)

Returns whether the supplied candidate satisfies all constraints configured in this specification.

public bool Matches(EventDefinition ev)

Parameters

ev EventDefinition

The candidate AsmResolver event definition.

Returns

bool

true if every configured constraint is satisfied; otherwise false.

Of(StringMatcher, StringMatcher?)

When only a name is supplied, matches by name; when an event type is supplied, also matches its type.

public static EventSpec Of(StringMatcher name, StringMatcher? eventType = null)

Parameters

name StringMatcher

The name matcher for the target member.

eventType StringMatcher

An optional matcher for the event type full name.

Returns

EventSpec

A new specification with the described constraints.

ToString()

Returns a readable representation of this object.

public override string ToString()

Returns

string

A readable description.

Operators

operator ==(EventSpec?, EventSpec?)

public static bool operator ==(EventSpec? left, EventSpec? right)

Parameters

left EventSpec
right EventSpec

Returns

bool

implicit operator EventSpec(string)

Converts a string into a EventSpec that matches the event name.

public static implicit operator EventSpec(string name)

Parameters

name string

The name matcher for the target member.

Returns

EventSpec

The specification created from the supplied string.

operator !=(EventSpec?, EventSpec?)

public static bool operator !=(EventSpec? left, EventSpec? right)

Parameters

left EventSpec
right EventSpec

Returns

bool