Class MethodDefinitionPattern
Defines the pattern matching on methods defined in a .NET module.
[GenerateKeyedMatchNode]
public record MethodDefinitionPattern : Pattern<MethodDefinition>, IEquatable<Pattern>, IEquatable<Pattern<MethodDefinition>>, IEquatable<MethodDefinitionPattern>
- Inheritance
-
MethodDefinitionPattern
- Implements
- Inherited Members
Constructors
MethodDefinitionPattern()
Constructs a new method pattern.
public MethodDefinitionPattern()
MethodDefinitionPattern(MethodDefinitionPattern)
protected MethodDefinitionPattern(MethodDefinitionPattern original)
Parameters
originalMethodDefinitionPattern
MethodDefinitionPattern(Pattern<MethodAttributes>, Pattern<TypeSignature>, Pattern<string?>, Pattern<IList<GenericParameter>>, Pattern<IReadOnlyList<Parameter>>, Pattern<MethodImplAttributes>, Pattern<CilMethodBody?>)
Defines the pattern matching on methods defined in a .NET module.
public MethodDefinitionPattern(Pattern<MethodAttributes> Attributes, Pattern<TypeSignature> ReturnType, Pattern<string?> Name, Pattern<IList<GenericParameter>> GenericParameters, Pattern<IReadOnlyList<Parameter>> Parameters, Pattern<MethodImplAttributes> ImplAttributes, Pattern<CilMethodBody?> Body)
Parameters
AttributesPattern<MethodAttributes>The pattern describing the attributes of the method.
ReturnTypePattern<TypeSignature>The pattern describing the return type of the method.
NamePattern<string>The pattern describing the name of the method.
GenericParametersPattern<IList<GenericParameter>>The pattern describing the list of generic type parameters the method defines.
ParametersPattern<IReadOnlyList<Parameter>>The pattern describing the list of parameters the methdo defines.
ImplAttributesPattern<MethodImplAttributes>The pattern describing the implementation attributes of the method.
BodyPattern<CilMethodBody>The pattern describing the body of the method.
Properties
Attributes
The pattern describing the attributes of the method.
public Pattern<MethodAttributes> Attributes { get; init; }
Property Value
Body
The pattern describing the body of the method.
public Pattern<CilMethodBody?> Body { get; init; }
Property Value
EqualityContract
protected override Type EqualityContract { get; }
Property Value
GenericParameters
The pattern describing the list of generic type parameters the method defines.
public Pattern<IList<GenericParameter>> GenericParameters { get; init; }
Property Value
ImplAttributes
The pattern describing the implementation attributes of the method.
public Pattern<MethodImplAttributes> ImplAttributes { get; init; }
Property Value
Name
The pattern describing the name of the method.
public Pattern<string?> Name { get; init; }
Property Value
Parameters
The pattern describing the list of parameters the methdo defines.
public Pattern<IReadOnlyList<Parameter>> Parameters { get; init; }
Property Value
ReturnType
The pattern describing the return type of the method.
public Pattern<TypeSignature> ReturnType { get; init; }
Property Value
Methods
Deconstruct(out Pattern<MethodAttributes>, out Pattern<TypeSignature>, out Pattern<string?>, out Pattern<IList<GenericParameter>>, out Pattern<IReadOnlyList<Parameter>>, out Pattern<MethodImplAttributes>, out Pattern<CilMethodBody?>)
public void Deconstruct(out Pattern<MethodAttributes> Attributes, out Pattern<TypeSignature> ReturnType, out Pattern<string?> Name, out Pattern<IList<GenericParameter>> GenericParameters, out Pattern<IReadOnlyList<Parameter>> Parameters, out Pattern<MethodImplAttributes> ImplAttributes, out Pattern<CilMethodBody?> Body)
Parameters
AttributesPattern<MethodAttributes>ReturnTypePattern<TypeSignature>NamePattern<string>GenericParametersPattern<IList<GenericParameter>>ParametersPattern<IReadOnlyList<Parameter>>ImplAttributesPattern<MethodImplAttributes>BodyPattern<CilMethodBody>
Equals(MethodDefinitionPattern?)
public virtual bool Equals(MethodDefinitionPattern? other)
Parameters
otherMethodDefinitionPattern
Returns
Equals(Pattern<MethodDefinition>?)
public override sealed bool Equals(Pattern<MethodDefinition>? other)
Parameters
otherPattern<MethodDefinition>
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(MethodDefinition, MatchingContext)
Attempts to match the provided input to the pattern.
public override IMatchNode<MethodDefinition>? Match(MethodDefinition input, MatchingContext context)
Parameters
inputMethodDefinitionThe input to match.
contextMatchingContextThe context in which to match the pattern to.
Returns
- IMatchNode<MethodDefinition>
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 ==(MethodDefinitionPattern?, MethodDefinitionPattern?)
public static bool operator ==(MethodDefinitionPattern? left, MethodDefinitionPattern? right)
Parameters
leftMethodDefinitionPatternrightMethodDefinitionPattern
Returns
operator !=(MethodDefinitionPattern?, MethodDefinitionPattern?)
public static bool operator !=(MethodDefinitionPattern? left, MethodDefinitionPattern? right)
Parameters
leftMethodDefinitionPatternrightMethodDefinitionPattern