Table of Contents

Class PatternExtensions

Namespace
ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching
Assembly
ICSharpCode.Decompiler.dll
public static class PatternExtensions
Inheritance
PatternExtensions
Inherited Members

Methods

IsMatch(INode, INode)

public static bool IsMatch(this INode pattern, INode other)

Parameters

pattern INode
other INode

Returns

bool

Match(INode, INode)

Performs a pattern matching operation. this is the pattern, other is the AST that is being matched.

public static Match Match(this INode pattern, INode other)

Parameters

pattern INode
other INode

Returns

Match

A match object. Check Success to see whether the match was successful.

Remarks

Patterns are ASTs that contain special pattern nodes (from the PatternMatching namespace). However, it is also possible to match two ASTs without any pattern nodes - doing so will produce a successful match if the two ASTs are structurally identical.

ToExpression(Pattern)

public static Expression ToExpression(this Pattern pattern)

Parameters

pattern Pattern

Returns

Expression

ToStatement(Pattern)

public static Statement ToStatement(this Pattern pattern)

Parameters

pattern Pattern

Returns

Statement

ToType(Pattern)

public static AstType ToType(this Pattern pattern)

Parameters

pattern Pattern

Returns

AstType

WithName(Expression, string)

public static Expression WithName(this Expression node, string patternGroupName)

Parameters

node Expression
patternGroupName string

Returns

Expression

WithName(Statement, string)

public static Statement WithName(this Statement node, string patternGroupName)

Parameters

node Statement
patternGroupName string

Returns

Statement