Class TypeSpec
- Namespace
- AsmLocator
- Assembly
- AsmLocator.dll
Describes constraints used to match a type definition.
public sealed record TypeSpec : IEquatable<TypeSpec>
- Inheritance
-
TypeSpec
- Implements
- Inherited Members
Constructors
TypeSpec()
public TypeSpec()
Properties
Attribute
The full name matcher for a custom attribute type.
public StringMatcher? Attribute { get; init; }
Property Value
BaseType
The base type full-name matcher.
public StringMatcher? BaseType { get; init; }
Property Value
DeclaringType
The specification of the declaring type for nested-type matching.
public TypeSpec? DeclaringType { get; init; }
Property Value
FullName
Nested type full names use the plus sign separator, for example Example.Outer+Inner.
public StringMatcher? FullName { get; init; }
Property Value
GenericParameterCount
The required number of generic parameters.
public int? GenericParameterCount { get; init; }
Property Value
- int?
Interfaces
The candidate type must implement every interface listed here.
public IReadOnlyList<StringMatcher>? Interfaces { get; init; }
Property Value
IsAbstract
Whether the type must be abstract.
public bool? IsAbstract { get; init; }
Property Value
- bool?
IsEnum
Whether the candidate must be an enum.
public bool? IsEnum { get; init; }
Property Value
- bool?
IsInterface
Whether the candidate must be an interface.
public bool? IsInterface { get; init; }
Property Value
- bool?
IsNested
Whether the candidate must be a nested type.
public bool? IsNested { get; init; }
Property Value
- bool?
IsSealed
Whether the candidate must be sealed.
public bool? IsSealed { get; init; }
Property Value
- bool?
IsValueType
Whether the candidate must be a value type.
public bool? IsValueType { 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
Namespace
The namespace matcher. When null, the namespace is not used as a constraint.
public StringMatcher? Namespace { get; init; }
Property Value
Where
An optional custom predicate applied after the built-in constraints.
public Func<TypeDefinition, bool>? Where { get; init; }
Property Value
Methods
ByFullName(StringMatcher)
Creates a type specification constrained by full name.
public static TypeSpec ByFullName(StringMatcher fullName)
Parameters
fullNameStringMatcherThe type full-name matcher.
Returns
- TypeSpec
A new specification with the described constraints.
ByName(StringMatcher)
Creates a specification constrained by member name.
public static TypeSpec ByName(StringMatcher name)
Parameters
nameStringMatcherThe type name matcher.
Returns
- TypeSpec
A new specification with the described constraints.
Equals(TypeSpec?)
public bool Equals(TypeSpec? other)
Parameters
otherTypeSpec
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
Matches(TypeDefinition)
Returns whether the supplied candidate satisfies all constraints configured in this specification.
public bool Matches(TypeDefinition type)
Parameters
typeTypeDefinitionThe candidate AsmResolver type definition.
Returns
NestedIn(TypeSpec, StringMatcher)
Creates a specification for a nested type with the supplied declaring type and nested type name.
public static TypeSpec NestedIn(TypeSpec outer, StringMatcher name)
Parameters
outerTypeSpecThe specification of the declaring type.
nameStringMatcherThe type name matcher.
Returns
- TypeSpec
A new specification with the described constraints.
Of(StringMatcher, StringMatcher)
Creates a type specification constrained by namespace and type name.
public static TypeSpec Of(StringMatcher @namespace, StringMatcher name)
Parameters
namespaceStringMatcherThe namespace matcher.
nameStringMatcherThe type name matcher.
Returns
- TypeSpec
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 ==(TypeSpec?, TypeSpec?)
public static bool operator ==(TypeSpec? left, TypeSpec? right)
Parameters
Returns
implicit operator TypeSpec(string)
Converts a full type name string into a TypeSpec.
public static implicit operator TypeSpec(string fullName)
Parameters
fullNamestringThe type full-name matcher.
Returns
- TypeSpec
The specification created from the supplied string.
operator !=(TypeSpec?, TypeSpec?)
public static bool operator !=(TypeSpec? left, TypeSpec? right)