ICollectionExpressionOperation Interface

Definition

Represents a collection expression.

Current usage:

  1. C# collection expression

public interface ICollectionExpressionOperation : Microsoft.CodeAnalysis.IOperation
type ICollectionExpressionOperation = interface
    interface IOperation
Public Interface ICollectionExpressionOperation
Implements IOperation
Implements

Remarks

This node is associated with the following operation kinds:

This interface is reserved for implementation by its associated APIs. We reserve the right to change it in the future.

Properties

Name Description
ChildOperations

An enumerable of child operations for this operation.

(Inherited from IOperation)
Children
Obsolete.

An array of child operations for this operation. Deprecated: please use ChildOperations.

(Inherited from IOperation)
ConstantValue

If the operation is an expression that evaluates to a constant value, HasValue is true and Value is the value of the expression. Otherwise, HasValue is false.

(Inherited from IOperation)
ConstructArguments

Arguments passed to to ConstructMethod, if present. Arguments are in evaluation order. This can be an empty array. Will never be default. If the arguments successfully bound, these will all be IArgumentOperation; otherwise, they can be any operation.

ConstructMethod

Method used to construct the collection.

  1. If the collection type is an array, span, or type parameter, the method is null.
  2. If the collection type has a [CollectionBuilder] attribute, the method is the builder method.
  3. If the collection type is a mutable array interface and the collection was initialized with arguments, the method is the constructor of List<T> that was used. If this is read-only array interface, or no arguments were provided, the method is null
  4. Otherwise, the method is the collection type constructor.
Elements

Collection expression elements.

If the element is an expression, the entry is the expression, with a conversion to the target element type if necessary; otherwise, the entry is an ISpreadOperation.

IsImplicit

Set to True if compiler generated /implicitly computed by compiler code

(Inherited from IOperation)
Kind

Identifies the kind of the operation.

(Inherited from IOperation)
Language

The source language of the IOperation. Possible values are CSharp and VisualBasic.

(Inherited from IOperation)
Parent

IOperation that has this operation as a child. Null for the root.

(Inherited from IOperation)
SemanticModel

Optional semantic model that was used to generate this operation. Non-null for operations generated from source with GetOperation(SyntaxNode, CancellationToken) API and operation callbacks made to analyzers. Null for operations inside a ControlFlowGraph.

(Inherited from IOperation)
Syntax

Syntax that was analyzed to produce the operation.

(Inherited from IOperation)
Type

Result type of the operation, or null if the operation does not produce a result.

(Inherited from IOperation)

Methods

Name Description
Accept(OperationVisitor) (Inherited from IOperation)
Accept<TArgument,TResult>(OperationVisitor<TArgument,TResult>, TArgument) (Inherited from IOperation)

Extension Methods

Name Description
Descendants(IOperation)

Returns all the descendant operations of the given operation in evaluation order.

DescendantsAndSelf(IOperation)

Returns all the descendant operations of the given operation including the given operation in evaluation order.

Applies to