Class FieldSpec
- Namespace
- AsmLocator
- Assembly
- AsmLocator.dll
Describes constraints used to match a field definition.
public sealed record FieldSpec : IEquatable<FieldSpec>
- Inheritance
-
FieldSpec
- Implements
- Inherited Members
Constructors
FieldSpec()
public FieldSpec()
Properties
Attribute
The custom attribute type full-name matcher.
public StringMatcher? Attribute { get; init; }
Property Value
FieldType
The field type full-name matcher.
public StringMatcher? FieldType { get; init; }
Property Value
IsInitOnly
Whether the field must be init-only (readonly).
public bool? IsInitOnly { get; init; }
Property Value
- bool?
IsLiteral
Whether the field must be a literal constant.
public bool? IsLiteral { get; init; }
Property Value
- bool?
IsPrivate
Whether the candidate must be private.
public bool? IsPrivate { get; init; }
Property Value
- bool?
IsPublic
Whether the candidate must be public.
public bool? IsPublic { get; init; }
Property Value
- bool?
IsStatic
Whether the candidate must be static.
public bool? IsStatic { get; init; }
Property Value
- bool?
Name
The member name matcher. When null, the name is not used as a constraint.
public StringMatcher? Name { get; init; }
Property Value
Where
An optional custom predicate applied after the built-in constraints.
public Func<FieldDefinition, bool>? Where { get; init; }
Property Value
Methods
ByName(StringMatcher)
Creates a specification constrained by member name.
public static FieldSpec ByName(StringMatcher name)
Parameters
nameStringMatcherThe name matcher for the target member.
Returns
- FieldSpec
A new specification with the described constraints.
Equals(FieldSpec?)
public bool Equals(FieldSpec? other)
Parameters
otherFieldSpec
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
Matches(FieldDefinition)
Returns whether the supplied candidate satisfies all constraints configured in this specification.
public bool Matches(FieldDefinition field)
Parameters
fieldFieldDefinitionThe candidate AsmResolver field definition.
Returns
Of(StringMatcher, StringMatcher?)
When only a name is supplied, matches by name; when a type is supplied, also matches the field type.
public static FieldSpec Of(StringMatcher name, StringMatcher? fieldType = null)
Parameters
nameStringMatcherThe name matcher for the target member.
fieldTypeStringMatcherAn optional matcher for the field type full name.
Returns
- FieldSpec
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 ==(FieldSpec?, FieldSpec?)
public static bool operator ==(FieldSpec? left, FieldSpec? right)
Parameters
Returns
implicit operator FieldSpec(string)
Converts a string into a FieldSpec that matches the field name.
public static implicit operator FieldSpec(string name)
Parameters
namestringThe name matcher for the target member.
Returns
- FieldSpec
The specification created from the supplied string.
operator !=(FieldSpec?, FieldSpec?)
public static bool operator !=(FieldSpec? left, FieldSpec? right)