CodeQL library for C#
codeql/csharp-all 3.1.1-dev (changelog, source)
Search

Module csharp

The default C# QL library.

Import path

import csharp

Predicates

extractionIsStandalone

Whether the source was extracted without a build command.

Classes

Access

An access expression. Either a this access (ThisAccess), a base access (BaseAccess), a member access (MemberAccess), an assignable access (AssignableAccess), or a callable access (CallableAccess).

AccessModifier

An access modifier: public, private, internal or protected.

Accessor

An accessor. Either a getter (Getter), a setter (Setter), or event accessor (EventAccessor).

AccessorCall

A call to an accessor. Either a property accessor call (PropertyCall), an indexer accessor call (IndexerCall), or an event accessor call (EventCall).

AddEventAccessor

An add event accessor, for example add on line 4 in

AddEventExpr

An event addition, for example line 9 in

AddExpr

An addition operation, for example x + y.

AddOperator

A user-defined addition operator (+), for example

AddOrRemoveEventExpr

An event assignment. Either an event addition (AddEventExpr) or an event removal (RemoveEventExpr).

AddressOfExpr

An address-of expression, for example &n on line 4 in

AndOperator

A user-defined and operator (&), for example

AndPatternExpr

A binary and pattern. For example, < 1 and > 2.

AnnotatedArrayType

An array type with additional type information.

AnnotatedConstructedType

A constructed type with additional type information.

AnnotatedType

A type with additional type information.

AnonymousClass

A class generated by the compiler from an anonymous object creation.

AnonymousFunctionExpr

An anonymous function. Either a lambda expression (LambdaExpr) or an anonymous method expression (AnonymousMethodExpr).

AnonymousMethodExpr

An anonymous method expression, for example delegate (int x) { return x + 1; }.

AnonymousObjectCreation

An anonymous constructor call, for example new { First = x[0], Last = x[x.Length - 1] } on line 2 in

ArglistType

The __arglist type, modeling varargs invocation in C++.

ArithmeticOperation

An arithmetic operation. Either a unary arithmetic operation (UnaryArithmeticOperation) or a binary arithmetic operation (BinaryArithmeticOperation).

ArrayAccess

An access to an array, for example the access to args on line 3 in

ArrayCreation

An array creation, for example new int[,] { {0, 1}, {2, 3}, {4, 5} }.

ArrayInitializer

An array initializer, for example { {0, 1}, {2, 3}, {4, 5} } in

ArrayRead

An access to an array that reads the underlying value, for example the access to a on line 2 in

ArrayType

An array type, for example int[].

ArrayWrite

An access to an array that updates the underlying value, for example the access to a on line 2 in

AsExpr

An as expression, for example x as string.

Assembly

A .NET assembly location.

AssemblyAttribute

An attribute with assembly kind, for example [...] on line 1 in csharp [assembly: MyAttribute(0)]

AssignAddExpr

An addition assignment operation, for example x += y.

AssignAndExpr

A bitwise-and assignment operation, for example x &= y.

AssignArithmeticOperation

An arithmetic assignment operation. Either an addition assignment operation (AssignAddExpr), a subtraction assignment operation (AssignSubExpr), a multiplication assignment operation (AssignMulExpr), a division assignment operation (AssignDivExpr), or a remainder assignment operation (AssignRemExpr).

AssignBitwiseOperation

A bitwise assignment operation. Either a bitwise-and assignment operation (AssignAndExpr), a bitwise-or assignment operation (AssignOrExpr), a bitwise exclusive-or assignment operation (AssignXorExpr), a left-shift assignment operation (AssignLeftShiftExpr), or a right-shift assignment operation (AssignRightShiftExpr), or an unsigned right-shift assignment operation (AssignUnsignedRightShiftExpr).

AssignCoalesceExpr

A null-coalescing assignment operation, for example x ??= y.

AssignDivExpr

An division assignment operation, for example x /= y.

AssignExpr

A simple assignment, for example x = 0.

AssignLeftShiftExpr

A left-shift assignment operation, for example x <<= y.

AssignMulExpr

An multiplication assignment operation, for example x *= y.

AssignOperation

An assignment operation. Either an arithmetic assignment operation (AssignArithmeticOperation), a bitwise assignment operation (AssignBitwiseOperation), or an event assignment (AddOrRemoveEventExpr).

AssignOrExpr

A bitwise-or assignment operation, for example x |= y.

AssignRemExpr

A remainder assignment operation, for example x %= y.

AssignRightShiftExpr

A right-shift assignment operation, for example x >>= y.

AssignSubExpr

A subtraction assignment operation, for example x -= y.

AssignUnsighedRightShiftExpr

An unsigned right-shift assignment operation, for example x >>>= y.

AssignXorExpr

A bitwise exclusive-or assignment operation, for example x ^= y.

Assignable

An assignable, that is, an element that can be assigned to. Either a variable (Variable), a property (Property), an indexer (Indexer), or an event (Event).

AssignableAccess

An assignable access, that is, an access that is valid on the left-hand side of some assignment. Either an access to a variable (VariableAccess), an access to a property (PropertyAccess), an access to an element (ElementAccess), an access to an event (EventAccess), or a dynamic member access (DynamicMemberAccess).

AssignableDefinition

An assignable definition.

AssignableMember

An assignable that is also a member. Either a field (Field), a property (Property), an indexer (Indexer), or an event (Event).

AssignableMemberAccess

An access to an assignable that is also a member. Either a field access (FieldAccess), a property access (PropertyAccess), an indexer access (IndexerAccess), or an event access (EventAccess).

AssignableRead

An access to an assignable that reads the underlying value. Either a variable read (VariableRead), a property read (PropertyRead), an indexer read (IndexerRead), or an event read (EventRead).

AssignableWrite

An access to an assignable that updates the underlying value. Either a variable write (VariableWrite), a property write (PropertyWrite), an indexer write (IndexerWrite), or an event write (EventWrite).

Assignment

An assignment. Either a local variable initialization (LocalVariableDeclAndInitExpr), a simple assignment (AssignExpr), or an assignment operation (AssignOperation).

Attributable

An element that can have attributes. Either an assembly (Assembly), a field (Field), a parameter (Parameter), an operator (Operator), a method (Method), a constructor (Constructor), a destructor (Destructor), a callable accessor (CallableAccessor), a value or reference type (ValueOrRefType), a declaration with accessors (DeclarationWithAccessors), a local function (LocalFunction) or a lambda expression (LambdaExp).

Attribute

An attribute, for example [...] on line 1 in

AwaitExpr

An await expression, for example await AsyncMethodThatReturnsTask().

BaseAccess

A base access, for example base on line 2 in

BinaryArithmeticOperation

A binary arithmetic operation. Either an addition operation (AddExpr), a subtraction operation (SubExpr), a multiplication operation (MulExpr), a division operation (DivExpr), or a remainder operation (RemExpr).

BinaryBitwiseOperation

A binary bitwise operation. Either a bitwise-and operation (BitwiseAndExpr), a bitwise-or operation (BitwiseOrExpr), a bitwise exclusive-or operation (BitwiseXorExpr), a left-shift operation (LeftShiftExpr), a right-shift operation (RightShiftExpr), or an unsigned right-shift operation (UnsignedRightShiftExpr).

BinaryLogicalOperation

A binary logical operation. Either a logical ‘and’ (LogicalAndExpr), a logical ‘or’ (LogicalAndExpr), or a null-coalescing operation (NullCoalescingExpr).

BinaryOperation

A binary operation. Either a binary arithmetic operation (BinaryArithmeticOperation), a binary bitwise operation (BinaryBitwiseOperation), a comparison operation (ComparisonOperation), or a binary logical operation (BinaryLogicalOperation).

BinaryOperator

A user-defined binary operator.

BinaryPatternExpr

A binary pattern. For example, 1 or 2.

BindingPatternExpr

A pattern that may bind a variable, for example string s in x is string s.

BitwiseAndExpr

A bitwise-and operation, for example x & y.

BitwiseOperation

A bitwise operation. Either a unary bitwise operation (UnaryBitwiseOperation) or a binary bitwise operation (BinaryBitwiseOperation).

BitwiseOrExpr

A bitwise-or operation, for example x | y.

BitwiseXorExpr

A bitwise exclusive-or operation, for example x ^ y.

BlockStmt

A block statement, for example

BoolLiteral

A Boolean literal, for example true.

BoolType

The Boolean type, bool.

BranchDirective

A branching preprocessor directive, such as IfDirective, ElifDirective, or ElseDirective.

BreakStmt

A break statement, for example line 4 in

ByteType

The byte type.

CDeclCallingConvention

An unmanaged C/C++-style calling convention where the call stack is cleaned by the caller.

Call

A call. Either a method call (MethodCall), a constructor initializer call (ConstructorInitializer), a call to a user-defined operator (OperatorCall), a delegate call (DelegateCall), an accessor call (AccessorCall), a constructor call (ObjectCreation), or a local function call (LocalFunctionCall).

Callable

An element that can be called.

CallableAccess

An access to a callable. Either a method access (MethodAccess) or a local function access (LocalFunctionAccess).

CallingConvention

A signature representing a calling convention. Specifies how arguments in a given signature are passed from the caller to the callee.

Case

A case expression or statement.

CaseStmt

A case statement.

Cast

A cast. Either an as expression (AsExpr) or a cast expression (CastExpr).

CastExpr

A cast expression, for example (string) x.

CatchClause

A catch clause within a try statement.

CharLiteral

A Unicode character literal, for example 'a'.

CharType

The Unicode character type, char.

CheckedAddOperator

A user-defined checked addition operator (+), for example

CheckedDecrementOperator

A user-defined checked decrement operator (--), for example

CheckedDivOperator

A user-defined checked division operator (/), for example

CheckedExplicitConversionOperator

A user-defined checked explicit conversion operator, for example

CheckedExpr

A checked expression, for example checked(2147483647 + ten).

CheckedIncrementOperator

A user-defined checked increment operator (++), for example

CheckedMinusOperator

A user-defined checked minus operator (-), for example

CheckedMulOperator

A user-defined checked multiplication operator (*), for example

CheckedStmt

A checked statement, for example

CheckedSubOperator

A user-defined checked subtraction operator (-), for example

Class

A class, for example

CollectionExpression

A collection expression, for example [1, 2, 3] on line 1 in csharp int[] x = [1, 2, 3];

CollectionInitializer

A collection initializer, for example { {0, "a"}, {1, "b"} } in

CommentBlock

A collection of adjacent comment lines, for example

CommentLine

A single line of comment.

ComparisonOperation

A comparison operation. Either an equality operation (EqualityOperation) or a relational operation (RelationalOperation).

ComplementExpr

A bitwise complement operation, for example ~x.

ComplementOperator

A user-defined complement operator (~), for example

ConditionalDirective

A preprocessor directive with a branching condition, such as IfDirective or ElifDirective.

ConditionalExpr

A conditional expression, for example s != null ? s.Length : -1 on line 2 in

ConstCase

A constant case of a switch statement, for example case OpCode.Nop: on line 2 in

ConstantPatternExpr

A constant pattern, for example false in x is (_, false).

ConstructedClass

A constructed (bound) class. (See the comments on ConstructedType for more information.)

ConstructedDelegateType

A constructed (bound) delegate type. (See the comments on ConstructedType for more information.)

ConstructedGeneric

A constructed generic.

ConstructedInterface

A C# constructed (bound) interface. (See the comments on ConstructedType for more information.)

ConstructedLocalFunction

A constructed generic local function, for example the target f<int> of the function call f(5) on line 4 in

ConstructedMethod

A constructed (bound) method, for example the target M<int> of the call on line 5 in

ConstructedStruct

A constructed (bound) struct. (See the comments on ConstructedType for more information.)

ConstructedType

A constructed (bound) type. This is a generic type for which actual type arguments have been supplied, for example G<int> or the G<T> in class Other<T> { G<T> g; }. Constructed types can be divided further into those that are open (for example G1<T> or G2<T,T,U,int>), in the sense that one or more of their type arguments is a type parameter, versus those that are closed (for example G1<int> or G2<long,long,float,int>).

Constructor

A constructor, for example public C() { } on line 2 in

ConstructorInitializer

A constructor initializer call, for example base() (line 6) and this(0) (line 8) in

ContinueStmt

A continue statement, for example line 4 in

ControlFlowElement

A program element that can possess control flow. That is, either a statement or an expression.

ConversionOperator

A user-defined conversion operator, for example

DecimalLiteral

A decimal literal, for example 5m.

DecimalType

The high-precision decimal type, decimal.

Declaration

A declaration.

DeclarationWithAccessors

A declaration that may have accessors. Either an event (Event), a property (Property), or an indexer (Indexer).

DeclarationWithGetSetAccessors

A declaration that may have a get accessor and a set accessor. Either a property (Property) or an indexer (Indexer).

DecrementOperation

A decrement operation. Either a postfix decrement operation (PostDecrExpr) or a prefix decrement operation (PreDecrExpr).

DecrementOperator

A user-defined decrement operator (--), for example

DefaultAttribute

An attribute with default kind, for example [...] on line 1 in csharp [MyAttribute(0)] int SomeMethod() { return 1; }

DefaultCallingConvention

A managed calling convention with fixed-length argument list.

DefaultCase

A default case of a switch statement, for example default: on line 3 in

DefaultLineDirective

A #line default directive.

DefaultValueExpr

A default expression, for example default or default(string).

DefineDirective

A #define directive.

DefineSymbolExpr

A preprocessor symbol inside an expression, such as DEBUG in line 2 csharp #define DEBUG #if (DEBUG == true) Console.WriteLine("Debug version"); #endif

DelegateCall

A delegate call, for example x() on line 5 in

DelegateCreation

A delegate creation. Either an explicit delegate creation (ExplicitDelegateCreation) or an implicit delegate creation (ImplicitDelegateCreation).

DelegateLikeCall

A function pointer or delegate call.

DelegateType

A delegate type, for example

Destructor

A destructor, for example ~C() { } on line 2 in

DiscardExpr

A discard expression, for example _ in

DiscardPatternExpr

A discard pattern, for example _ in x is (_, false)

DivExpr

A division operation, for example x / y.

DivOperator

A user-defined division operator (/), for example

DoStmt

A do-while statement, for example

DoubleLiteral

A double literal, for example 5D.

DoubleType

The double type.

DynamicAccess

An access where the qualifier is a dynamic expression. Either a dynamic member access (DynamicMemberAccess) or a dynamic element access (DynamicElementAccess).

DynamicAccessorCall

A call to an accessor where the qualifier is a dynamic expression, for example d.X on line 20 and d[0] on line 25 in

DynamicElementAccess

An element access where the qualifier is a dynamic expression, for example d[0] on line 12 in

DynamicElementRead

An access to a dynamic element that reads the underlying value, for example d[0] on line 12 in

DynamicElementWrite

An access to a dynamic element that updates the underlying value, for example d[0] on line 12 in

DynamicExpr

An expression involving one or more dynamic sub expressions. Either a dynamic constructor call (DynamicObjectCreation), a dynamic method call (DynamicMethodCall), a dynamic operator call (DynamicOperatorCall), a dynamic member access (DynamicMemberAccess), a dynamic accessor call (DynamicAccessorCall), or a dynamic element access (DynamicElementAccess).

DynamicMember

A possible target of a dynamic member access (DynamicMemberAccess). Either a field (Field), a property (Property), or an event (Event).

DynamicMemberAccess

A member access where the qualifier is a dynamic expression, for example d.X on line 24 in

DynamicMemberRead

An access to a dynamic member that reads the underlying value, for example d.X on line 16 in

DynamicMemberWrite

An access to a dynamic member that updates the underlying value, for example d.X on line 16 in

DynamicMethodCall

A method call where the qualifier or one of the arguments is a dynamic expression, for example M(d) on line 8 in

DynamicMutatorOperatorCall

A call to a user-defined mutator operator where the operand is a dynamic expression, for example d++ on line 20 in

DynamicObjectCreation

A constructor call where one of the arguments is a dynamic expression, for example new A(d) on line 8 in

DynamicOperatorCall

A call to a user-defined operator where one of the operands is a dynamic expression, for example this + d on line 12 in

DynamicType

The dynamic type.

EQExpr

An equals operation, for example x == y.

EQOperator

A user-defined equals operator (==), for example

Element

A program element. Either a control flow element (ControlFlowElement), an attribute (Attribute), a declaration (Declaration), a modifier (Modifier), a namespace (Namespace), a namespace declaration (NamespaceDeclaration), a using directive (UsingDirective), or type parameter constraints (TypeParameterConstraints).

ElementAccess

An access to an element. Either an access to an indexer (IndexerAccess), an access to an array (ArrayAccess), or a dynamic element access (DynamicElementAccess).

ElementInitializer

An element initializer, for example the implicit call to Add(0, "a") on line 2 in

ElementRead

An access to an element that reads the underlying value. Either an access to an indexer (IndexerRead), an access to an array (ArrayRead), or an access to a dynamic element (DynamicElementRead).

ElementWrite

An access to an element that updates the underlying value. Either an access to an indexer (IndexerWrite), an access to an array (ArrayWrite), or an access to a dynamic element (DynamicElementWrite).

ElifDirective

An #elif preprocessor directive.

ElseDirective

An #else preprocessor directive.

EmptyLocation

An empty location.

EmptyStmt

An empty statement, for example line 2 in

EndRegionDirective

An #endregion directive.

EndifDirective

An #endif preprocessor directive.

Enum

An enum. For example

EnumConstant

An enum member constant. For example, ReadOnly and Shared in

EqualityOperation

An equality operation. Either an equals operation (EQExpr) or a not-equals operation (NEExpr).

ErrorDirective

An #error directive.

Event

An event, for example E on line 3 in

EventAccess

An access to an event, for example the accesses to Click on lines 7 and 8 in

EventAccessExpr

An internal helper class to share logic between EventAccess and EventCall.

EventAccessor

An event accessor, for example add on line 4 or remove on line 5 in

EventCall

A call to an event accessor, for example the call to add_Click (defined on line 5) on line 12 in

EventRead

An access to an event that reads the underlying value, for example the accesses to Click on lines 7 and 8 in

EventWrite

An access to an event that updates the underlying value, for example the access to Click on line 7 in

ExceptionClass

A class that derives from System.Exception, and may be thrown as an exception.

ExplicitCast

An explicit cast. For example, the explicit cast from object to string on line 2 in

ExplicitConversionOperator

A user-defined explicit conversion operator, for example

ExplicitDelegateCreation

An explicit delegate creation, for example new D(M) on line 6 in

Expr

An expression. Either an access (Access), a call (Call), an object or collection initializer (ObjectOrCollectionInitializer), a delegate creation (DelegateCreation), an array initializer (ArrayInitializer), an array creation (ArrayCreation), an anonymous function (AnonymousFunctionExpr), a local variable declaration (LocalVariableDeclExpr), an operation (Operation), a parenthesized expression (ParenthesizedExpr), a checked expression (CheckedExpr), an unchecked expression (UncheckedExpr), an is expression (IsExpr), an as expression (AsExpr), a cast (CastExpr), a typeof expression (TypeofExpr), a default expression (DefaultValueExpr), an await expression (AwaitExpr), a nameof expression (NameOfExpr), an interpolated string (InterpolatedStringExpr), a qualifiable expression (QualifiableExpr), or a literal (Literal).

ExprStmt

An expression statement, for example M1() on line 5

ExtensionMethod

An extension method, for example

ExtensionMethodCall

A call to an extension method, for example lines 5 and 6 in

FalseOperator

A user-defined false operator (false), for example

FastCallCallingConvention

An unmanaged calling convention where arguments are passed in registers when possible.

Field

A field. For example, the fields x and y in

FieldAccess

An access to a field, for example the access to F on line 5 in

FieldRead

An access to a field that reads the underlying value, for example the access to F on line 5 in

FieldWrite

An access to a field that updates the underlying value, for example the access to F on line 5 in

File

A file.

FixedStmt

A fixed statement, for example lines 3–5 in

FloatLiteral

A float literal, for example 5F.

FloatType

The float type.

FloatingPointType

A floating point type.

ForStmt

A for loop, for example

ForeachStmt

A foreach loop, for example

FunctionPointerCall

A function pointer call, for example fp(1) on line 3 in

FunctionPointerType

A function pointer type, for example

GEExpr

A greater-than or equals operation, for example x >= y.

GEOperator

A user-defined greater than or equals operator (>=), for example

GEPattern

A greater-than or equals pattern, for example >= 10 in x is >= 10

GTExpr

A greater-than operation, for example x > y.

GTOperator

A user-defined greater than operator (>), for example

GTPattern

A greater-than pattern, for example > 10 in x is > 10.

GeneralCatchClause

A general catch clause that does not specify the exception being caught.

Generic

A generic declaration. Either an unbound generic (UnboundGeneric) or a constructed generic (ConstructedGeneric).

GenericAssemblyAttribute

A generic attribute with assembly kind, for example [...] on line 1 in csharp [assembly: MyAttribute<string>(0)]

GenericAttribute

A generic attribute, for example [...] on line 1 in

GenericDefaultAttribute

A generic attribute with default kind, for example [...] on line 1 in csharp [MyAttribute<string>(0)] int SomeMethod() { return 1; }

GenericModuleAttribute

A generic attribute with module kind, for example [...] on line 1 in csharp [module: MyAttribute<string>(0)]

GenericReturnAttribute

A generic attribute with return kind, for example [...] on line 1 in csharp [return: MyAttribute<object>(0)] int SomeMethod() { return 1; }

Getter

A get accessor, for example get { return p; } in

GlobalNamespace

The global namespace. This is the root of all namespaces.

GotoCaseStmt

A goto case statement that jumps to a switch case.

GotoDefaultStmt

A goto default statement that jumps to the default case.

GotoLabelStmt

A goto statement that jumps to a labeled statement, for example line 4 in

GotoStmt

A goto statement.

HiddenLineDirective

A #line hidden directive.

IfDirective

An #if preprocessor directive.

IfStmt

An if statement, for example

ImplicitAccessorParameter

An implicit accessor or event accessor parameter corresponding to the special value parameter. For example, the value parameter of set_ReadOnly in

ImplicitCast

An implicit cast. For example, the implicit cast from string to object on line 3 in

ImplicitConversionOperator

A user-defined implicit conversion operator, for example

ImplicitDelegateCreation

An implicit delegate creation, for example the access to M on line 6 in

IncrementOperation

An increment operation. Either a postfix increment operation (PostIncrExpr) or a prefix increment operation (PreIncrExpr).

IncrementOperator

A user-defined increment operator (++), for example

IndexExpr

An index expression, for example ^1 meaning “1 from the end”.

Indexer

An indexer, for example string this[int i] on line 2 in

IndexerAccess

An access to an indexer, for example the access to c on line 5 in

IndexerAccessExpr

An internal helper class to share logic between IndexerAccess and IndexerCall.

IndexerCall

A call to an indexer accessor, for example the call to get_Item (defined on line 3) on line 7 in

IndexerProperty

A Property which holds a type with an indexer.

IndexerRead

An access to an indexer that reads the underlying value, for example the access to c on line 5 in

IndexerWrite

An access to an indexer that updates the underlying value, for example the access to c on line 5 in

InlineArrayType

An inline array type, for example MyInlineArray in csharp [System.Runtime.CompilerServices.InlineArray(10)] public struct MyInlineArray { private int _elements0; }

InstanceConstructor

An instance constructor (as opposed to a static constructor), for example public C() { } on line 2 in

IntLiteral

An int literal, for example 0.

IntType

The int type.

IntegerLiteral

An integer literal. Either an int literal (IntLiteral), a long literal (LongLiteral), a uint literal (UIntLiteral), or a ulong literal (ULongLiteral).

IntegralType

An integral type.

Interface

An interface, for example

InterpolatedStringExpr

An interpolated string, for example $"Hello, {name}!" on line 2 in

IsExpr

An is expression.

JumpStmt

A statement that changes the control flow and jumps to another statement.

LEExpr

A less-than or equals operation, for example x <= y.

LEOperator

A user-defined less than or equals operator (<=), for example

LEPattern

A less-than or equals pattern, for example <= 10 in x is <= 10.

LTExpr

A less-than operation, for example x < y.

LTOperator

A user-defined lesser than operator (<), for example

LTPattern

A less-than pattern, for example < 10 in x is < 10.

LabelStmt

A label statement, for example line 7 in

LabeledPatternExpr

A labeled pattern in a property pattern, for example Length: 5 in { Length: 5 }.

LabeledStmt

A labeled statement.

LambdaExpr

A lambda expression, for example (int x) => x + 1.

LateBindableExpr

An expression whose target may be late bound when using dynamic subexpressions. Either a method call (MethodCall), an operator call (OperatorCall), a constructor call (ObjectCreation), a dynamic member access (DynamicMemberAccess), or a dynamic element access (DynamicElementAccess).

LeftShiftExpr

A left-shift operation, for example x << y.

LeftShiftOperator

A user-defined left shift operator (<<), for example

LineDirective

A #line directive, such as #line default, #line hidden, or #line directive with line number.

ListPatternExpr

A list pattern. For example [1, 2, int y] in x is [1, 2, int y].

Literal

A literal. Either a Boolean literal (BoolLiteral), a Unicode character literal (CharLiteral), an integer literal (IntegerLiteral), a floating point literal (RealLiteral), a string literal (StringLiteral), or a null literal (NullLiteral).

LocalConstant

A local constant, modeled as a special kind of local variable. For example, the local constant maxTries in

LocalConstantDeclExpr

A local constant declaration, for example const int i = 0.

LocalConstantDeclStmt

A local constant declaration statement, for example line 2 in

LocalFunction

A local function, defined within the scope of another callable. For example, Fac on lines 2–4 in

LocalFunctionAccess

An access to a local function, for example the access to Filter on line 4 in

LocalFunctionCall

A call to a local function, for example the call Fac(n) on line 6 in

LocalFunctionStmt

A statement defining a local function. For example, the statement on lines 2–4 in

LocalScopeVariable

A locally scoped variable. Either a local variable (LocalVariable) or a parameter (Parameter).

LocalScopeVariableAccess

An access to a local scope variable. Either an access to a parameter (ParameterAccess) or an access to a local variable (LocalVariableAccess).

LocalScopeVariableRead

An access to a local scope variable that reads the underlying value. Either an access to a parameter (ParameterRead) or an access to a local variable (LocalVariableRead).

LocalScopeVariableWrite

An access to a local scope variable that updates the underlying value. Either an access to a parameter (ParameterWrite) or an access to a local variable (LocalVariableWrite).

LocalVariable

A local variable, declared within the scope of a callable. For example, the variables total and s in

LocalVariableAccess

An access to a local variable, for example the access to x on line 3 in

LocalVariableDeclAndInitExpr

A local variable initialization, for example int x = 0.

LocalVariableDeclExpr

A local variable declaration, for example var i = 0.

LocalVariableDeclStmt

A local declaration statement, for example line 2 in

LocalVariableRead

An access to a local variable that reads the underlying value, for example the access to x on line 3 in

LocalVariableWrite

An access to a local variable that updates the underlying value, for example the access to x on line 3 in

Location

A location of a program element.

LockStmt

A lock statement, for example

LogicalAndExpr

A logical ‘and’, for example x != null && x.Length > 0.

LogicalNotExpr

A logical ‘not’, for example !String.IsNullOrEmpty(s).

LogicalOperation

A logical operation. Either a unary logical operation (UnaryLogicalOperation), a binary logical operation (BinaryLogicalOperation), or a ternary logical operation (TernaryLogicalOperation).

LogicalOrExpr

A logical ‘or’, for example x == null || x.Length == 0.

LongLiteral

A long literal, for example -5L.

LongType

The long type.

LoopStmt

A loop statement.

Member

A declaration that is a member of a type.

MemberAccess

A member access. Either an access to a field (FieldAccess), an access to a property (PropertyAccess), an access to an indexer (IndexerAccess), an access to an event (EventAccess), an access to a method (MethodAccess), an access to a type (TypeAccess), or a dynamic member access (DynamicMemberAccess).

MemberConstant

A member constant, modeled a special kind of field. For example, the constant Separator in

MemberConstantAccess

An access to a member (field), for example the access to F on line 5 in

MemberInitializer

A member initializer, for example X = 0 on line 6 in

Method

A method, for example

MethodAccess

An access to a method, for example the access to Filter on line 5 in

MethodCall

A method call, for example a.M() on line 5 in

MinusOperator

A user-defined minus operator (-), for example

Modifiable

A declaration that can have a modifier.

Modifier

A modifier, for example static, virtual, public and so on.

ModuleAttribute

An attribute with module kind, for example [...] on line 1 in csharp [module: MyAttribute(0)]

MulExpr

A multiplication operation, for example x * y.

MulOperator

A user-defined multiplication operator (*), for example

MultilineComment

A line of comment in a multiline style, for example each of the lines in

MutatorOperation

A mutator operation. Either an increment operation (IncrementOperation) or a decrement operation (DecrementOperation).

MutatorOperatorCall

A call to a user-defined mutator operator, for example a++ on line 7 in

NEExpr

A not-equals operation, for example x != y.

NEOperator

A user-defined not equals operator (!=), for example

NameOfExpr

A nameof expression, for example nameof(s) on line 3 in

NamedElement

An element that has a name.

Namespace

A namespace, for example

NamespaceAccess

An access to a namespace, for example System in nameof(System).

NamespaceDeclaration

An explicit namespace declaration in a source file. For example:

NestedType

A nested type, for example class B in

NonConstructedMethod

A method that is not constructed. That is, either a method that is not a generic method or an unbound generic method (UnboundGenericMethod).

NonNestedType

A non-nested type, that is declared directly in a namespace.

NotOperator

A user-defined not operator (!), for example

NotPatternExpr

A not pattern. For example, not 1.

NullCoalescingExpr

A null-coalescing operation, for example s ?? "" on line 2 in

NullLiteral

A null literal.

NullType

The null type. The type of the null literal.

NullableDirective

A #nullable directive.

NullableType

A nullable type, for example int?.

NumericLineDirective

A numeric #line directive, such as #line 200 file.

ObjectCreation

A constructor call, for example new A() on line 3 in

ObjectInitializer

An object initializer, for example { X = 0, Y = 1 } on line 6 in

ObjectOrCollectionInitializer

Either an object initializer (ObjectInitializer) or a collection initializer (CollectionInitializer).

ObjectType

The object type, System.Object.

Operation

An operation. Either an assignment (Assignment), a unary operation (UnaryOperation), a binary operation (BinaryOperation), or a ternary operation (TernaryOperation).

Operator

A user-defined operator.

OperatorCall

A call to a user-defined operator, for example this + other on line 7 in

OrOperator

A user-defined or operator (|), for example

OrPatternExpr

A binary or pattern. For example, 1 or 2.

Overridable

A declaration that can be overridden or implemented. That is, a method, a property, an indexer, an event, an accessor, or an operator.

Parameter

A parameter of a parameterizable declaration (callable, delegate, or indexer). For example, p in

ParameterAccess

An access to a parameter, for example the access to p on line 2 in

ParameterRead

An access to a parameter that reads the underlying value, for example the access to p on line 2 in

ParameterWrite

An access to a parameter that updates the underlying value, for example the access to p on line 2 in

Parameterizable

A parameterizable declaration. Either a callable (Callable), a delegate type (DelegateType), or an indexer (Indexer).

ParenthesizedExpr

A parenthesized expression, for example (2 + 3) in

PatternExpr

A pattern expression, for example (_, false) in

PatternMatch

An expression or statement that matches the value of an expression against a pattern. Either an is expression or a case expression/statement.

PlusOperator

A user-defined plus operator (+), for example

PointerIndirectionExpr

A pointer indirection operation, for example *pn on line 7, pa->M() on line 13, and cp[1] on line 18 in

PointerType

A pointer type, for example char*.

PositionalPatternExpr

A positional pattern. For example, (int x, int y).

PostDecrExpr

A postfix decrement operation, for example x--.

PostIncrExpr

A postfix increment operation, for example x++.

PragmaChecksumDirective

A #pragma checksum directive.

PragmaWarningDirective

A #pragma warning directive.

PreDecrExpr

A prefix decrement operation, for example --x.

PreIncrExpr

A prefix increment operation, for example ++x.

PreprocessorDirective

A preprocessor directive, such as PragmaWarningDirective, PragmaChecksumDirective, DefineDirective, UndefineDirective, WarningDirective, ErrorDirective, NullableDirective, LineDirective, RegionDirective, EndRegionDirective, BranchDirective, or EndifDirective.

PrimaryConstructor

A primary constructor, for example public class C(object o) on line 1 in csharp public class C(object o) { ... }

Property

A property, for example P on line 2 in

PropertyAccess

An access to a property, for example the access to P on line 5 in

PropertyAccessExpr

An internal helper class to share logic between PropertyAccess and PropertyCall.

PropertyCall

A call to a property accessor, for example the call to get_P on line 5 in

PropertyPatternExpr

A property pattern. For example, { Length: 5 }.

PropertyRead

An access to a property that reads the underlying value, for example the access to P on line 5 in

PropertyWrite

An access to a property that updates the underlying value, for example the access to P on line 5 in

QualifiableExpr

An expression that may have a qualifier. Either a member access (MemberAccess), an element access (ElementAccess), a method call (MethodCall) or a property access (PropertyAccess), or an accessor call (AccessorCall).

RangeExpr

A range expression, used to create a System.Range. For example csharp 1..3 1..^1 3.. .. ..5 ..^1

RealLiteral

A floating point literal. Either a float literal (FloatLiteral), a double literal (DoubleLiteral), or a decimal literal (DecimalLiteral).

RecordClass

A record, for example

RecordCloneMethod

A clone method on a record.

RecordStruct

A record struct, for example csharp record struct RS { ... }

RecordType

A record like type. This can be either a class or a struct.

RecursivePatternExpr

A recursive pattern expression, for example string { Length: 5 } s in x is string { Length: 5 } s.

RefExpr

A reference expression, for example ref a[i] on line 2 in

RefType

A reference type.

RegionDirective

A #region directive.

RelationalOperation

A relational operation. Either a greater-than operation (GTExpr), a less-than operation (LTExpr), a greater-than or equals operation (GEExpr), or a less-than or equals operation (LEEexpr).

RelationalPatternExpr

A relational pattern, for example >1 in x is >1.

RemExpr

A remainder operation, for example x % y.

RemOperator

A user-defined remainder operator (%), for example

RemoveEventAccessor

A remove event accessor, for example remove on line 5 in

RemoveEventExpr

An event removal, for example line 9 in

ReturnAttribute

An attribute with return kind, for example [...] on line 1 in csharp [return: MyAttribute(0)] int SomeMethod() { return 1; }

ReturnStmt

A return statement, for example line 2 in

RightShiftExpr

A right-shift operation, for example x >> y.

RightShiftOperator

A user-defined right shift operator (>>), for example

SByteType

The signed byte type, sbyte.

SelectionStmt

A conditional statement.

Setter

A set accessor, for example set { p = value; } in

ShortType

The short type.

SignedIntegralType

A signed integral type.

SimpleType

A simple type. Simple types in C# are predefined struct types. Here, however, they are not modeled as such, and we reserve the notion of structs to user-defined structs.

SinglelineComment

A single-line comment, for example line 1 in

SizeofExpr

A sizeof expression, for example sizeof(int).

SlicePatternExpr

A slice pattern. For example .. in `x is [1, .., 2].

SourceFile

A source file.

SourceLocation

A location in source code, comprising of a source file and a segment of text within the file.

SpanLineDirective

A line span #line directive, such as #line (1, 1) - (3, 10) 5 file.

SpecificCatchClause

A catch clause that catches a specific exception.

SpreadElementExpr

A spread element expression, for example .. x in [1, 2, .. x]

Stackalloc

A stackalloc array creation, for example stackalloc char[] { 'x', 'y' }.

StaticConstructor

A static constructor (as opposed to an instance constructor), for example static public C() { } on line 2 in

StdCallCallingConvention

An unmanaged calling convention where call stack is cleaned up by the callee.

Stmt

A statement.

StringLiteral

A string literal. Either a string literal (StringLiteralUtf16), or a u8 literal (StringLiteralUtf8).

StringLiteralUtf16

A string literal, for example "Hello, World!".

StringLiteralUtf8

A u8 literal, for example "AUTH"u8

StringType

The string type, System.String.

Struct

A struct, for example

SubExpr

A subtraction operation, for example x - y.

SubOperator

A user-defined subtraction operator (-), for example

SuppressNullableWarningExpr

A nullable warning suppression expression, for example x! in csharp string GetName() { string? x = ...; return x!; }

Switch

A switch expression or statement.

SwitchCaseExpr

An arm of a switch expression, for example (false, false) => true.

SwitchExpr

A switch expression, for example csharp (a,b) switch { (false, false) => true, _ => false };

SwitchStmt

A switch statement, for example

TernaryLogicalOperation

A ternary logical operation, that is, a ternary conditional expression (ConditionalExpr).

TernaryOperation

A ternary operation, that is, a ternary conditional operation (ConditionalExpr).

ThisAccess

A this access, for example this on line 5 in

ThisCallCallingConvention

An unmanaged C++-style calling convention for calling instance member functions with a fixed argument list.

ThrowElement

A throw element. Either a throw expression (ThrowExpr) or a throw statement (ThrowStmt).

ThrowExpr

A throw expression, for example throw new ArgumentException("i") in return i != 0 ? 1 / i : throw new ArgumentException("i");

ThrowStmt

A throw statement, for example line 3 in

TrivialProperty

A property with a trivial getter and setter. For example, properties P1 and P2 are trivial, while P3 is not, in

TrivialPropertyAccess

An access to a trivial property - a property with a default getter and setter. For example, the access to P on line 5 in

TrueOperator

A user-defined true operator (true), for example

TryStmt

A try statement, for example

TupleExpr

An expression representing a tuple, for example (1, 2) on line 2 or (var x, var y) on line 5 in

TupleType

A type representing a tuple. For example, (int, bool, string).

Type

A type.

TypeAccess

An access to a type, for example the access to C on line 3 in

TypeAccessPatternExpr

A type access pattern, for example string in x is string.

TypeContainer

A type container. Either a namespace (Namespace) or a type (Type).

TypeMention

A type mention, that is, any mention of a type in a source code file. For example, int is mentioned in int M() { return 1; }.

TypeParameter

A type parameter, for example T in List<T>.

TypeParameterConstraints

A set of type parameter constraints.

TypePatternExpr

A type pattern, for example string in x is string, string s in x is string s, or string _ in x is string _.

TypeofExpr

A typeof expression, for example typeof(string).

UIntLiteral

A uint literal, for example 5U.

UIntType

The unsigned int type, uint.

ULongLiteral

A ulong literal, for example 5UL.

ULongType

The unsigned long type, ulong.

UShortType

The unsigned short type, ushort.

UnaryArithmeticOperation

A unary arithmetic operation. Either a unary minus operation (UnaryMinusExpr), a unary plus operation (UnaryPlusExpr), or a mutator operation (MutatorOperation).

UnaryBitwiseOperation

A unary bitwise operation, that is, a bitwise complement operation (ComplementExpr).

UnaryLogicalOperation

A unary logical operation, that is, a logical ‘not’ (LogicalNotExpr).

UnaryMinusExpr

A unary minus operation, for example -x.

UnaryOperation

A unary operation. Either a unary arithmetic operation (UnaryArithmeticOperation), a unary bitwise operation (UnaryBitwiseOperation), a sizeof operation (SizeofExpr), a pointer indirection operation (PointerIndirectionExpr), an address-of operation (AddressOfExpr), or a unary logical operation (UnaryLogicalOperation).

UnaryOperator

A user-defined unary operator - an operator taking one operand.

UnaryPatternExpr

A unary pattern. For example, not 1.

UnaryPlusExpr

A unary plus operation, for example +x.

UnboundGeneric

A generic declaration with type parameters.

UnboundGenericClass

An unbound generic class, for example

UnboundGenericDelegateType

An unbound generic delegate type. (See the comments on UnboundGenericType for more information.)

UnboundGenericInterface

An unbound generic interface, for example

UnboundGenericMethod

An unbound generic method. This is a generic method whose signature involves formal type parameters, For example M<T> on line 2 in

UnboundGenericStruct

An unbound generic struct. (See the comments on UnboundGenericType for more information.)

UnboundGenericType

An unbound generic type. This is a generic type with type parameters (for example List<T>) or elided type parameters (for example List`1).

UnboundLocalFunction

An unbound generic local function, for example f on line 3 in

UncheckedExpr

An unchecked expression, for example unchecked(ConstantMax + 10).

UncheckedStmt

An unchecked statement, for example

UndefineDirective

An #undef directive.

UnknownType

A type that could not be resolved. This could happen if an indirect reference is not available at compilation time.

UnmanagedCallingConvention

An unmanaged calling convention that indicates that the specifics are encoded as modopts.

UnsafeStmt

An unsafe statement, for example

UnsignedIntegralType

An unsigned integral type.

UnsignedRightShiftExpr

An unsigned right-shift operation, for example x >>> y.

UnsignedRightShiftOperator

A user-defined unsigned right shift operator (>>>), for example

UsingBlockStmt

A using block statement, for example

UsingDeclStmt

A using declaration statement, for example

UsingDirective

A using directive. Either a namespace using directive (UsingNamespaceDirective) or a type using directive (UsingStaticDirective).

UsingNamespaceDirective

A namespace using directive, for example using System.

UsingStaticDirective

A type using directive, for example using static System.Console.

UsingStmt

A using block or declaration. Either a using declaration (UsingDeclStmt) or a using block (UsingBlockStmt).

ValueOrRefType

A value or reference type.

ValueType

A value type.

VarArgsCallingConvention

A managed calling convention for passing extra arguments.

Variable

A variable. Either a variable with local scope (LocalScopeVariable) or a field (Field).

VariableAccess

An access to a variable. Either an access to a local scope variable (LocalScopeVariableAccess) or an access to a field (FieldAccess).

VariablePatternExpr

A variable declaration pattern, for example string s in x is string s.

VariableRead

An access to a variable that reads the underlying value. Either an access to a local scope variable (LocalScopeVariableRead) or an access to a field (FieldRead).

VariableWrite

An access to a variable that updates the underlying value. Either an access to a local scope variable (LocalScopeVariableWrite) or an access to a field (FieldWrite).

Version

An assembly version, for example 4.0.0.0 or 4.5.

VirtualEventAccess

An access to a virtual event - an event that is virtual or defined in an interface. For example, the accesses to Click on lines 7 and 8 in

VirtualIndexerAccess

An access to a virtual indexer - an indexer that is virtual or defined in an interface. For example, the access to c on line 5 in

VirtualMethodAccess

An access to a virtual method - a method that is virtual or defined in an interface. For example, the access to Filter on line 5 in

VirtualMethodCall

A virtual method call, for example a.M() on line 5 in

VirtualPropertyAccess

An access to a virtual property - a property that is virtual or defined in an interface. For example, the access to P on line 5 in

Virtualizable

A member where the virtual modifier is valid. That is, a method, a property, an indexer, an event, or an operator.

VoidType

The void type.

WarningDirective

A #warning directive.

WhileStmt

A while statement, for example

WithExpr

A with expression called on a record.

XmlCommentLine

A line of XML documentation comment, for example each of the lines in

XorOperator

A user-defined xor operator (^), for example

YieldBreakStmt

A yield break statement, for example line 6 in

YieldReturnStmt

A yield return statement, for example line 4 in

YieldStmt

A yield statement.

Modules

AssignableDefinitions

Provides different types of AssignableDefinitions.

AssignableInternal

INTERNAL: Do not use.

ControlFlow

Provides classes representing the control flow graph within callables.

DataFlow
Ssa

Provides classes for working with static single assignment (SSA) form.

TaintTracking

Aliases

Container

A file or folder.

Folder

A folder.