Class MethodReferencePattern
Defines the pattern matching on method descriptors.
[GenerateKeyedMatchNode]
public record MethodReferencePattern : Pattern<IMethodDescriptor>, IEquatable<Pattern>, IEquatable<Pattern<IMethodDescriptor>>, IEquatable<MethodReferencePattern>
- Inheritance
-
MethodReferencePattern
- Implements
- Inherited Members
Constructors
MethodReferencePattern(MethodReferencePattern)
protected MethodReferencePattern(MethodReferencePattern original)
Parameters
originalMethodReferencePattern
MethodReferencePattern(Pattern<bool>, Pattern<TypeSignature>, Pattern<ITypeDefOrRef?>, Pattern<string?>, Pattern<IReadOnlyList<TypeSignature>>, Pattern<IReadOnlyList<TypeSignature>>)
Defines the pattern matching on method descriptors.
public MethodReferencePattern(Pattern<bool> HasThis, Pattern<TypeSignature> ReturnType, Pattern<ITypeDefOrRef?> DeclaringType, Pattern<string?> Name, Pattern<IReadOnlyList<TypeSignature>> TypeArguments, Pattern<IReadOnlyList<TypeSignature>> ParameterTypes)
Parameters
HasThisPattern<bool>The pattern describing the flag indicating the method is static or instance.
ReturnTypePattern<TypeSignature>The pattern describing the return type of the method.
DeclaringTypePattern<ITypeDefOrRef>The pattern describing the type that is defining the method.
NamePattern<string>The pattern describing the name of the method.
TypeArgumentsPattern<IReadOnlyList<TypeSignature>>The pattern describing the generic type arguments that were provided to instantiate the method.
ParameterTypesPattern<IReadOnlyList<TypeSignature>>The pattern describing the parameters of the method.
Fields
AnyMethod
Describes the pattern for any valid method descriptor.
public static readonly Pattern<IMethodDescriptor> AnyMethod
Field Value
Properties
DeclaringType
The pattern describing the type that is defining the method.
public Pattern<ITypeDefOrRef?> DeclaringType { get; init; }
Property Value
EqualityContract
protected override Type EqualityContract { get; }
Property Value
HasThis
The pattern describing the flag indicating the method is static or instance.
public Pattern<bool> HasThis { get; init; }
Property Value
Name
The pattern describing the name of the method.
public Pattern<string?> Name { get; init; }
Property Value
ParameterTypes
The pattern describing the parameters of the method.
public Pattern<IReadOnlyList<TypeSignature>> ParameterTypes { get; init; }
Property Value
ReturnType
The pattern describing the return type of the method.
public Pattern<TypeSignature> ReturnType { get; init; }
Property Value
TypeArguments
The pattern describing the generic type arguments that were provided to instantiate the method.
public Pattern<IReadOnlyList<TypeSignature>> TypeArguments { get; init; }
Property Value
Methods
Deconstruct(out Pattern<bool>, out Pattern<TypeSignature>, out Pattern<ITypeDefOrRef?>, out Pattern<string?>, out Pattern<IReadOnlyList<TypeSignature>>, out Pattern<IReadOnlyList<TypeSignature>>)
public void Deconstruct(out Pattern<bool> HasThis, out Pattern<TypeSignature> ReturnType, out Pattern<ITypeDefOrRef?> DeclaringType, out Pattern<string?> Name, out Pattern<IReadOnlyList<TypeSignature>> TypeArguments, out Pattern<IReadOnlyList<TypeSignature>> ParameterTypes)
Parameters
HasThisPattern<bool>ReturnTypePattern<TypeSignature>DeclaringTypePattern<ITypeDefOrRef>NamePattern<string>TypeArgumentsPattern<IReadOnlyList<TypeSignature>>ParameterTypesPattern<IReadOnlyList<TypeSignature>>
Equals(MethodReferencePattern?)
public virtual bool Equals(MethodReferencePattern? other)
Parameters
otherMethodReferencePattern
Returns
Equals(Pattern<IMethodDescriptor>?)
public override sealed bool Equals(Pattern<IMethodDescriptor>? other)
Parameters
otherPattern<IMethodDescriptor>
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Format(IndentedTextWriter)
Serializes the pattern to a readable string.
public override void Format(IndentedTextWriter writer)
Parameters
writerIndentedTextWriterThe output stream.
GetHashCode()
public override int GetHashCode()
Returns
Match(IMethodDescriptor, MatchingContext)
Attempts to match the provided input to the pattern.
public override IMatchNode<IMethodDescriptor>? Match(IMethodDescriptor input, MatchingContext context)
Parameters
inputIMethodDescriptorThe input to match.
contextMatchingContextThe context in which to match the pattern to.
Returns
- IMatchNode<IMethodDescriptor>
When successful, returns the root node of the match tree, otherwise
null.
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
Operators
operator ==(MethodReferencePattern?, MethodReferencePattern?)
public static bool operator ==(MethodReferencePattern? left, MethodReferencePattern? right)
Parameters
leftMethodReferencePatternrightMethodReferencePattern
Returns
operator !=(MethodReferencePattern?, MethodReferencePattern?)
public static bool operator !=(MethodReferencePattern? left, MethodReferencePattern? right)
Parameters
leftMethodReferencePatternrightMethodReferencePattern