Microsoft.CodeAnalysis.Operations Namespace

Classes

OperationExtensions
OperationVisitor

Represents a IOperation visitor that visits only the single IOperation passed into its Visit method.

OperationVisitor<TArgument,TResult>

Represents a IOperation visitor that visits only the single IOperation passed into its Visit method with an additional argument of the type specified by the TArgument parameter and produces a value of the type specified by the TResult parameter.

OperationWalker

Represents a OperationVisitor that descends an entire IOperation tree visiting each IOperation and its child IOperation nodes in depth-first order.

OperationWalker<TArgument>

Represents a OperationVisitor<TArgument,TResult> that descends an entire IOperation tree visiting each IOperation and its child IOperation nodes in depth-first order. Returns null.

Structs

CommonConversion

Represents the common, language-agnostic elements of a conversion.

Interfaces

IAddressOfOperation

Represents an operation that creates a pointer value by taking the address of a reference.

Current usage: (1) C# address of expression

IAnonymousFunctionOperation

Represents an anonymous function operation.

Current usage: (1) C# lambda expression. (2) VB anonymous delegate expression.

IAnonymousObjectCreationOperation

Represents a creation of anonymous object.

Current usage: (1) C# "new { ... }" expression (2) VB "New With { ... }" expression

IArgumentOperation

Represents an argument to a method invocation.

Current usage: (1) C# argument to an invocation expression, object creation expression, etc. (2) VB argument to an invocation expression, object creation expression, etc.

IArrayCreationOperation

Represents the creation of an array instance.

Current usage: (1) C# array creation expression. (2) VB array creation expression.

IArrayElementReferenceOperation

Represents a reference to an array element.

Current usage: (1) C# array element reference expression. (2) VB array element reference expression.

IArrayInitializerOperation

Represents the initialization of an array instance.

Current usage: (1) C# array initializer. (2) VB array initializer.

IAssignmentOperation

Represents a base interface for assignments.

Current usage: (1) C# simple, compound and deconstruction assignment expressions. (2) VB simple and compound assignment expressions.

IAttributeOperation

Represents the application of an attribute.

Current usage: (1) C# attribute application. (2) VB attribute application.

IAwaitOperation

Represents an await operation.

Current usage: (1) C# await expression. (2) VB await expression.

IBinaryOperation

Represents an operation with two operands and a binary operator that produces a result with a non-null type.

Current usage: (1) C# binary operator expression. (2) VB binary operator expression.

IBinaryPatternOperation

Represents a binary ("and" or "or") pattern.

Current usage: (1) C# "and" and "or" patterns.

IBlockOperation

Represents a block containing a sequence of operations and local declarations.

Current usage: (1) C# "{ ... }" block statement. (2) VB implicit block statement for method bodies and other block scoped statements.

IBranchOperation

Represents a branch operation.

Current usage: (1) C# goto, break, or continue statement. (2) VB GoTo, Exit ***, or Continue *** statement.

ICaseClauseOperation

Represents a case clause.

Current usage: (1) C# case clause. (2) VB Case clause.

ICatchClauseOperation

Represents a catch clause.

Current usage: (1) C# catch clause. (2) VB Catch clause.

ICoalesceAssignmentOperation

Represents a coalesce assignment operation with a target and a conditionally-evaluated value: (1) Target is evaluated for null. If it is null, Value is evaluated and assigned to target. (2) Value is conditionally evaluated if Target is null, and the result is assigned into Target. The result of the entire expression isTarget, which is only evaluated once.

Current usage: (1) C# null-coalescing assignment operation Target ??= Value.

ICoalesceOperation

Represents a coalesce operation with two operands: (1) Value, which is the first operand that is unconditionally evaluated and is the result of the operation if non null. (2) WhenNull, which is the second operand that is conditionally evaluated and is the result of the operation if Value is null.

Current usage: (1) C# null-coalescing expression "Value ?? WhenNull". (2) VB binary conditional expression "If(Value, WhenNull)".

ICollectionElementInitializerOperation

Obsolete interface that used to represent a collection element initializer. It has been replaced by IInvocationOperation and IDynamicInvocationOperation, as appropriate.

Current usage: None. This API has been obsoleted in favor of IInvocationOperation and IDynamicInvocationOperation.

ICollectionExpressionOperation

Represents a collection expression.

Current usage: (1) C# collection expression.

ICompoundAssignmentOperation

Represents a compound assignment that mutates the target with the result of a binary operation.

Current usage: (1) C# compound assignment expression. (2) VB compound assignment expression.

IConditionalAccessInstanceOperation

Represents the value of a conditionally-accessed operation within WhenNotNull. For a conditional access operation of the form someExpr?.Member, this operation is used as the InstanceReceiver for the right operation Member. See https://github.com/dotnet/roslyn/issues/21279#issuecomment-323153041 for more details.

Current usage: (1) C# conditional access instance expression. (2) VB conditional access instance expression.

IConditionalAccessOperation

Represents a conditionally accessed operation. Note that IConditionalAccessInstanceOperation is used to refer to the value of Operation within WhenNotNull.

Current usage: (1) C# conditional access expression (? or ?. operator). (2) VB conditional access expression (? or ?. operator).

IConditionalOperation

Represents a conditional operation with: (1) Condition to be tested, (2) WhenTrue operation to be executed when Condition is true and (3) WhenFalse operation to be executed when the Condition is false.

Current usage: (1) C# ternary expression "a ? b : c" and if statement. (2) VB ternary expression "If(a, b, c)" and If Else statement.

IConstantPatternOperation

Represents a pattern with a constant value.

Current usage: (1) C# constant pattern.

IConstructorBodyOperation

Represents a constructor method body operation.

Current usage: (1) C# method body for constructor declaration

IConversionOperation

Represents a type conversion.

Current usage: (1) C# conversion expression. (2) VB conversion expression.

IDeclarationExpressionOperation

Represents a declaration expression operation. Unlike a regular variable declaration IVariableDeclaratorOperation and IVariableDeclarationOperation, this operation represents an "expression" declaring a variable.

Current usage: (1) C# declaration expression. For example, (a) "var (x, y)" is a deconstruction declaration expression with variables x and y. (b) "(var x, var y)" is a tuple expression with two declaration expressions. (c) "M(out var x);" is an invocation expression with an out "var x" declaration expression.

IDeclarationPatternOperation

Represents a pattern that declares a symbol.

Current usage: (1) C# declaration pattern.

IDeconstructionAssignmentOperation

Represents a assignment with a deconstruction.

Current usage: (1) C# deconstruction assignment expression.

IDefaultCaseClauseOperation

Represents a default case clause.

Current usage: (1) C# default clause. (2) VB Case Else clause.

IDefaultValueOperation

Represents a default value operation.

Current usage: (1) C# default value expression.

IDelegateCreationOperation

Represents a delegate creation. This is created whenever a new delegate is created.

Current usage: (1) C# delegate creation expression. (2) VB delegate creation expression.

IDiscardOperation

Represents a discard operation.

Current usage: C# discard expressions

IDiscardPatternOperation

Represents a discard pattern.

Current usage: C# discard pattern

IDynamicIndexerAccessOperation

Represents an indexer access that is dynamically bound.

Current usage: (1) C# dynamic indexer access expression.

IDynamicInvocationOperation

Represents a invocation that is dynamically bound.

Current usage: (1) C# dynamic invocation expression. (2) C# dynamic collection element initializer. For example, in the following collection initializer: new C() { do1, do2, do3 } where the doX objects are of type dynamic, we'll have 3 IDynamicInvocationOperation with do1, do2, and do3 as their arguments. (3) VB late bound invocation expression. (4) VB dynamic collection element initializer. Similar to the C# example, New C() From {do1, do2, do3} will generate 3 IDynamicInvocationOperation nodes with do1, do2, and do3 as their arguments, respectively.

IDynamicMemberReferenceOperation

Represents a reference to a member of a class, struct, or module that is dynamically bound.

Current usage: (1) C# dynamic member reference expression. (2) VB late bound member reference expression.

IDynamicObjectCreationOperation

Represents an object creation with a dynamically bound constructor.

Current usage: (1) C# "new" expression with dynamic argument(s). (2) VB late bound "New" expression.

IEmptyOperation

Represents an empty or no-op operation.

Current usage: (1) C# empty statement.

IEndOperation

Represents an operation that stops the execution of code abruptly.

Current usage: (1) VB End Statement.

IEventAssignmentOperation

Represents a binding of an event.

Current usage: (1) C# event assignment expression. (2) VB Add/Remove handler statement.

IEventReferenceOperation

Represents a reference to an event.

Current usage: (1) C# event reference expression. (2) VB event reference expression.

IExpressionStatementOperation

Represents an operation that drops the resulting value and the type of the underlying wrapped Operation.

Current usage: (1) C# expression statement. (2) VB expression statement.

IFieldInitializerOperation

Represents an initialization of a field.

Current usage: (1) C# field initializer with equals value clause. (2) VB field(s) initializer with equals value clause or AsNew clause. Multiple fields can be initialized with AsNew clause in VB.

IFieldReferenceOperation

Represents a reference to a field.

Current usage: (1) C# field reference expression. (2) VB field reference expression.

IForEachLoopOperation

Represents a for each loop.

Current usage: (1) C# 'foreach' loop statement (2) VB 'For Each' loop statement

IForLoopOperation

Represents a for loop.

Current usage: (1) C# 'for' loop statement

IForToLoopOperation

Represents a for to loop with loop control variable and initial, limit and step values for the control variable.

Current usage: (1) VB 'For ... To ... Step' loop statement

IFunctionPointerInvocationOperation

Represents an invocation of a function pointer.

IImplicitIndexerReferenceOperation

Represents a reference to an implicit System.Index or System.Range indexer over a non-array type.

Current usage: (1) C# implicit System.Index or System.Range indexer reference expression.

IIncrementOrDecrementOperation

Represents an Increment or Decrement operation. Note that this operation is different from an IUnaryOperation as it mutates the Target, while unary operator expression does not mutate it's operand.

Current usage: (1) C# increment expression or decrement expression.

IInlineArrayAccessOperation

Represents an element reference or a slice operation over an inline array type.

Current usage: (1) C# inline array access.

IInstanceReferenceOperation

Represents an implicit/explicit reference to an instance.

Current usage: (1) C# this or base expression. (2) VB Me, MyClass, or MyBase expression. (3) C# object or collection or 'with' expression initializers. (4) VB With statements, object or collection initializers.

IInterpolatedStringAdditionOperation

Represents an addition of multiple interpolated string literals being converted to an interpolated string handler type.

IInterpolatedStringAppendOperation

Represents a call to either AppendLiteral or AppendFormatted as part of an interpolated string handler conversion.

IInterpolatedStringContentOperation

Represents a constituent part of an interpolated string.

Current usage: (1) C# interpolated string content. (2) VB interpolated string content.

IInterpolatedStringHandlerArgumentPlaceholderOperation

Represents an argument from the method call, indexer access, or constructor invocation that is creating the containing IInterpolatedStringHandlerCreationOperation

IInterpolatedStringHandlerCreationOperation

Represents an interpolated string converted to a custom interpolated string handler type.

IInterpolatedStringOperation

Represents an interpolated string.

Current usage: (1) C# interpolated string expression. (2) VB interpolated string expression.

IInterpolatedStringTextOperation

Represents a constituent string literal part of an interpolated string operation.

Current usage: (1) C# interpolated string text. (2) VB interpolated string text.

IInterpolationOperation

Represents a constituent interpolation part of an interpolated string operation.

Current usage: (1) C# interpolation part. (2) VB interpolation part.

IInvalidOperation

Represents an invalid operation with one or more child operations.

Current usage: (1) C# invalid expression or invalid statement. (2) VB invalid expression or invalid statement.

IInvocationOperation

Represents an invocation of a method.

Current usage: (1) C# method invocation expression. (2) C# collection element initializer. For example, in the following collection initializer: new C() { 1, 2, 3 }, we will have 3 IInvocationOperation nodes, each of which will be a call to the corresponding Add method with either 1, 2, 3 as the argument. (3) VB method invocation expression. (4) VB collection element initializer. Similar to the C# example, New C() From {1, 2, 3} will have 3 IInvocationOperation nodes with 1, 2, and 3 as their arguments, respectively.

IIsPatternOperation

Represents an operation that tests if a value matches a specific pattern.

Current usage: (1) C# is pattern expression. For example, "x is int i".

IIsTypeOperation

Represents an operation that tests if a value is of a specific type.

Current usage: (1) C# "is" operator expression. (2) VB "TypeOf" and "TypeOf IsNot" expression.

ILabeledOperation

Represents an operation with a label.

Current usage: (1) C# labeled statement. (2) VB label statement.

IListPatternOperation

Represents a C# list pattern.

ILiteralOperation

Represents a textual literal numeric, string, etc.

Current usage: (1) C# literal expression. (2) VB literal expression.

ILocalFunctionOperation

Represents a local function defined within a method.

Current usage: (1) C# local function statement.

ILocalReferenceOperation

Represents a reference to a declared local variable.

Current usage: (1) C# local reference expression. (2) VB local reference expression.

ILockOperation

Represents a Body of operations that are executed while holding a lock onto the LockedValue.

Current usage: (1) C# lock statement. (2) VB SyncLock statement.

ILoopOperation

Represents a loop operation.

Current usage: (1) C# 'while', 'for', 'foreach' and 'do' loop statements (2) VB 'While', 'ForTo', 'ForEach', 'Do While' and 'Do Until' loop statements

IMemberInitializerOperation

Represents an initialization of member within an object initializer with a nested object or collection initializer.

Current usage: (1) C# nested member initializer expression. For example, given an object creation with initializer "new Class() { X = x, Y = { x, y, 3 }, Z = { X = z } }", member initializers for Y and Z, i.e. "Y = { x, y, 3 }", and "Z = { X = z }" are nested member initializers represented by this operation.

IMemberReferenceOperation

Represents a reference to a member of a class, struct, or interface.

Current usage: (1) C# member reference expression. (2) VB member reference expression.

IMethodBodyBaseOperation

Represents a method body operation.

Current usage: (1) C# method body

IMethodBodyOperation

Represents a method body operation.

Current usage: (1) C# method body for non-constructor

IMethodReferenceOperation

Represents a reference to a method other than as the target of an invocation.

Current usage: (1) C# method reference expression. (2) VB method reference expression.

INameOfOperation

Represents an operation that gets a string value for the Argument name.

Current usage: (1) C# nameof expression. (2) VB NameOf expression.

INegatedPatternOperation

Represents a negated pattern.

Current usage: (1) C# negated pattern.

IObjectCreationOperation

Represents creation of an object instance.

Current usage: (1) C# new expression. (2) VB New expression.

IObjectOrCollectionInitializerOperation

Represents an initialization for an object or collection creation.

Current usage: (1) C# object or collection initializer expression. (2) VB object or collection initializer expression. For example, object initializer "{ X = x }" within object creation "new Class() { X = x }" and collection initializer "{ x, y, 3 }" within collection creation "new MyList() { x, y, 3 }".

IOmittedArgumentOperation

Represents an argument value that has been omitted in an invocation.

Current usage: (1) VB omitted argument in an invocation expression.

IParameterInitializerOperation

Represents an initialization of a parameter at the point of declaration.

Current usage: (1) C# parameter initializer with equals value clause. (2) VB parameter initializer with equals value clause.

IParameterReferenceOperation

Represents a reference to a parameter.

Current usage: (1) C# parameter reference expression. (2) VB parameter reference expression.

IParenthesizedOperation

Represents a parenthesized operation.

Current usage: (1) VB parenthesized expression.

IPatternCaseClauseOperation

Represents a case clause with a pattern and an optional guard operation.

Current usage: (1) C# pattern case clause.

IPatternOperation

Represents a pattern matching operation.

Current usage: (1) C# pattern.

IPropertyInitializerOperation

Represents an initialization of a property.

Current usage: (1) C# property initializer with equals value clause. (2) VB property initializer with equals value clause or AsNew clause. Multiple properties can be initialized with 'WithEvents' declaration with AsNew clause in VB.

IPropertyReferenceOperation

Represents a reference to a property.

Current usage: (1) C# property reference expression. (2) VB property reference expression.

IPropertySubpatternOperation

Represents an element of a property subpattern, which identifies a member to be matched and the pattern to match it against.

IRaiseEventOperation

Represents an operation for raising an event.

Current usage: (1) VB raise event statement.

IRangeCaseClauseOperation

Represents a case clause with range of values for comparison.

Current usage: (1) VB range case clause of the form "Case x To y".

IRangeOperation

Represents a range operation.

Current usage: (1) C# range expressions

IRecursivePatternOperation

Represents a C# recursive pattern.

IReDimClauseOperation

Represents an individual clause of an IReDimOperation to re-allocate storage space for a single array variable.

Current usage: (1) VB ReDim clause.

IReDimOperation

Represents the ReDim operation to re-allocate storage space for array variables.

Current usage: (1) VB ReDim statement.

IRelationalCaseClauseOperation

Represents a case clause with custom relational operator for comparison.

Current usage: (1) VB relational case clause of the form "Case Is op x".

IRelationalPatternOperation

Represents a pattern comparing the input with a constant value using a relational operator.

Current usage: (1) C# relational pattern.

IReturnOperation

Represents a return from the method with an optional return value.

Current usage: (1) C# return statement and yield statement. (2) VB Return statement.

ISimpleAssignmentOperation

Represents a simple assignment operation.

Current usage: (1) C# simple assignment expression. (2) VB simple assignment expression.

ISingleValueCaseClauseOperation

Represents a case clause with a single value for comparison.

Current usage: (1) C# case clause of the form "case x" (2) VB case clause of the form "Case x".

ISizeOfOperation

Represents an operation to compute the size of a given type.

Current usage: (1) C# sizeof expression.

ISlicePatternOperation

Represents a C# slice pattern.

ISpreadOperation

Represents a collection expression spread element.

Current usage: (1) C# spread element.

IStopOperation

Represents an operation to stop or suspend execution of code.

Current usage: (1) VB Stop statement.

ISwitchCaseOperation

Represents a switch case section with one or more case clauses to match and one or more operations to execute within the section.

Current usage: (1) C# switch section for one or more case clause and set of statements to execute. (2) VB case block with a case statement for one or more case clause and set of statements to execute.

ISwitchExpressionArmOperation

Represents one arm of a switch expression.

ISwitchExpressionOperation

Represents a switch expression.

Current usage: (1) C# switch expression.

ISwitchOperation

Represents a switch operation with a value to be switched upon and switch cases.

Current usage: (1) C# switch statement. (2) VB Select Case statement.

ISymbolInitializerOperation

Represents an initializer for a field, property, parameter or a local variable declaration.

Current usage: (1) C# field, property, parameter or local variable initializer. (2) VB field(s), property, parameter or local variable initializer.

IThrowOperation

Represents an operation to throw an exception.

Current usage: (1) C# throw expression. (2) C# throw statement. (2) VB Throw statement.

ITranslatedQueryOperation

Represents an unrolled/lowered query operation. For example, for a C# query expression "from x in set where x.Name != null select x.Name", the Operation tree has the following shape: ITranslatedQueryExpression IInvocationExpression ('Select' invocation for "select x.Name") IInvocationExpression ('Where' invocation for "where x.Name != null") IInvocationExpression ('From' invocation for "from x in set")

Current usage: (1) C# query expression. (2) VB query expression.

ITryOperation

Represents a try operation for exception handling code with a body, catch clauses and a finally handler.

Current usage: (1) C# try statement. (2) VB Try statement.

ITupleBinaryOperation

Represents a comparison of two operands that returns a bool type.

Current usage: (1) C# tuple binary operator expression.

ITupleOperation

Represents a tuple with one or more elements.

Current usage: (1) C# tuple expression. (2) VB tuple expression.

ITypeOfOperation

Represents an operation that gets Type for the given TypeOperand.

Current usage: (1) C# typeof expression. (2) VB GetType expression.

ITypeParameterObjectCreationOperation

Represents a creation of a type parameter object, i.e. new T(), where T is a type parameter with new constraint.

Current usage: (1) C# type parameter object creation expression. (2) VB type parameter object creation expression.

ITypePatternOperation

Represents a pattern comparing the input with a given type.

Current usage: (1) C# type pattern.

IUnaryOperation

Represents an operation with one operand and a unary operator.

Current usage: (1) C# unary operation expression. (2) VB unary operation expression.

IUsingDeclarationOperation

Represents using variable declaration, with scope spanning across the parent IBlockOperation.

Current Usage: (1) C# using declaration (1) C# asynchronous using declaration

IUsingOperation

Represents a Body of operations that are executed while using disposable Resources.

Current usage: (1) C# using statement. (2) VB Using statement.

IUtf8StringOperation

Represents a UTF-8 encoded byte representation of a string.

Current usage: (1) C# UTF-8 string literal expression.

IVariableDeclarationGroupOperation

Represents a variable declaration statement.

IVariableDeclarationOperation

Represents a declarator that declares multiple individual variables.

IVariableDeclaratorOperation

Represents a single variable declarator and initializer.

IVariableInitializerOperation

Represents an initialization of a local variable.

Current usage: (1) C# local variable initializer with equals value clause. (2) VB local variable initializer with equals value clause or AsNew clause.

IWhileLoopOperation

Represents a while or do while loop.

Current usage: (1) C# 'while' and 'do while' loop statements. (2) VB 'While', 'Do While' and 'Do Until' loop statements.

IWithOperation

Represents cloning of an object instance.

Current usage: (1) C# with expression.

Enums

ArgumentKind

Kinds of arguments.

BinaryOperatorKind

Kind of binary operator.

BranchKind

Kind of the branch for an IBranchOperation

CaseKind

Kinds of cases.

InstanceReferenceKind

Kind of reference for an IInstanceReferenceOperation.

InterpolatedStringArgumentPlaceholderKind

Kind of placeholder for an IInterpolatedStringHandlerArgumentPlaceholderOperation.

LoopKind

Kinds of loop operations.

UnaryOperatorKind

Kind of unary operator