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
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
ParameterType
The parameter type full-name matcher.
public StringMatcher? ParameterType { get; init; }
Property Value
Where
An optional custom predicate applied after the built-in constraints.
public Func<Parameter, bool>? Where { get; init; }
Property Value
Methods
At(int)
Creates a specification constrained by a zero-based index.
public static ParameterSpec At(int index)
Parameters
indexintThe zero-based parameter index.
Returns
- ParameterSpec
A new specification with the described constraints.
Equals(ParameterSpec?)
public bool Equals(ParameterSpec? other)
Parameters
otherParameterSpec
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
Matches(Parameter)
Returns whether the supplied candidate satisfies all constraints configured in this specification.
public bool Matches(Parameter parameter)
Parameters
parameterParameterThe candidate method parameter.
Returns
Named(StringMatcher)
Creates a parameter specification constrained by parameter name.
public static ParameterSpec Named(StringMatcher name)
Parameters
nameStringMatcherThe 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
nameStringMatcherThe name matcher for the target member.
typeStringMatcherThe 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
typeStringMatcherThe 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
leftParameterSpecrightParameterSpec
Returns
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
typestringThe 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
leftParameterSpecrightParameterSpec