Class LocalSpec

Namespace
AsmLocator
Assembly
AsmLocator.dll

Describes constraints used to match a CIL local variable.

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

Constructors

LocalSpec()

public LocalSpec()

Properties

Index

The zero-based index within the parameter or local-variable collection.

public int? Index { get; init; }

Property Value

int?

VariableType

The local variable type full-name matcher.

public StringMatcher? VariableType { get; init; }

Property Value

StringMatcher

Where

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

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

Property Value

Func<CilLocalVariable, bool>

Methods

At(int)

Creates a specification constrained by a zero-based index.

public static LocalSpec At(int index)

Parameters

index int

The zero-based local-variable index.

Returns

LocalSpec

A new specification with the described constraints.

Equals(LocalSpec?)

public bool Equals(LocalSpec? other)

Parameters

other LocalSpec

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Matches(CilLocalVariable)

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

public bool Matches(CilLocalVariable local)

Parameters

local CilLocalVariable

The candidate CIL local variable.

Returns

bool

true if every configured constraint is satisfied; otherwise false.

OfType(StringMatcher)

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

public static LocalSpec OfType(StringMatcher type)

Parameters

type StringMatcher

The local variable type full-name matcher.

Returns

LocalSpec

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

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

Parameters

left LocalSpec
right LocalSpec

Returns

bool

implicit operator LocalSpec(string)

Converts a string into a LocalSpec that matches the local type full name.

public static implicit operator LocalSpec(string type)

Parameters

type string

The local variable type full-name matcher.

Returns

LocalSpec

The specification created from the supplied string.

operator !=(LocalSpec?, LocalSpec?)

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

Parameters

left LocalSpec
right LocalSpec

Returns

bool