Class ParameterSpec

Namespace
AsmLocator
Assembly
AsmLocator.dll

Describes constraints used to match a method parameter.

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

Constructors

ParameterSpec()

public ParameterSpec()

Properties

Attribute

The custom attribute type full-name matcher.

public StringMatcher? Attribute { get; init; }

Property Value

StringMatcher

Index

The zero-based parameter index. The implicit this reference is not part of the parameter collection.

public int? Index { get; init; }

Property Value

int?

Name

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

public StringMatcher? Name { get; init; }

Property Value

StringMatcher

ParameterType

The parameter type full-name matcher.

public StringMatcher? ParameterType { get; init; }

Property Value

StringMatcher

Where

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

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

Property Value

Func<Parameter, bool>

Methods

At(int)

Creates a specification constrained by a zero-based index.

public static ParameterSpec At(int index)

Parameters

index int

The zero-based parameter index.

Returns

ParameterSpec

A new specification with the described constraints.

Equals(ParameterSpec?)

public bool Equals(ParameterSpec? other)

Parameters

other ParameterSpec

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Matches(Parameter)

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

public bool Matches(Parameter parameter)

Parameters

parameter Parameter

The candidate method parameter.

Returns

bool

true if every configured constraint is satisfied; otherwise false.

Named(StringMatcher)

Creates a parameter specification constrained by parameter name.

public static ParameterSpec Named(StringMatcher name)

Parameters

name StringMatcher

The name matcher for the target member.

Returns

ParameterSpec

A new specification with the described constraints.

Of(StringMatcher, StringMatcher)

Creates a parameter specification constrained by parameter name and type.

public static ParameterSpec Of(StringMatcher name, StringMatcher type)

Parameters

name StringMatcher

The name matcher for the target member.

type StringMatcher

The parameter type full-name matcher.

Returns

ParameterSpec

A new specification with the described constraints.

OfType(StringMatcher)

Creates a specification constrained by the full name of a type.

public static ParameterSpec OfType(StringMatcher type)

Parameters

type StringMatcher

The parameter type full-name matcher.

Returns

ParameterSpec

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 ==(ParameterSpec?, ParameterSpec?)

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

Parameters

left ParameterSpec
right ParameterSpec

Returns

bool

implicit operator ParameterSpec(string)

Converts a string into a ParameterSpec that matches the parameter type full name.

public static implicit operator ParameterSpec(string type)

Parameters

type string

The parameter type full-name matcher.

Returns

ParameterSpec

The specification created from the supplied string.

operator !=(ParameterSpec?, ParameterSpec?)

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

Parameters

left ParameterSpec
right ParameterSpec

Returns

bool