Share via


CSharpExtensions Class

Definition

public ref class CSharpExtensions abstract sealed
public static class CSharpExtensions
type CSharpExtensions = class
Public Module CSharpExtensions
Inheritance
CSharpExtensions

Methods

AnalyzeControlFlow(SemanticModel, StatementSyntax, StatementSyntax)

Analyze control-flow within a part of a method body.

AnalyzeControlFlow(SemanticModel, StatementSyntax)

Analyze control-flow within a part of a method body.

AnalyzeDataFlow(SemanticModel, ConstructorInitializerSyntax)

Analyze data-flow within a ConstructorInitializerSyntax.

AnalyzeDataFlow(SemanticModel, ExpressionSyntax)

Analyze data-flow within an ExpressionSyntax.

AnalyzeDataFlow(SemanticModel, PrimaryConstructorBaseTypeSyntax)

Analyze data-flow within a ArgumentList initializer.

AnalyzeDataFlow(SemanticModel, StatementSyntax, StatementSyntax)

Analyze data-flow within a part of a method body.

AnalyzeDataFlow(SemanticModel, StatementSyntax)

Analyze data-flow within a part of a method body.

ClassifyConversion(Compilation, ITypeSymbol, ITypeSymbol)
ClassifyConversion(SemanticModel, ExpressionSyntax, ITypeSymbol, Boolean)

Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression.

ClassifyConversion(SemanticModel, Int32, ExpressionSyntax, ITypeSymbol, Boolean)

Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression.

GetAliasInfo(SemanticModel, IdentifierNameSyntax, CancellationToken)

If nameSyntax resolves to an alias name, return the AliasSymbol corresponding to A. Otherwise return null.

GetAwaitExpressionInfo(SemanticModel, AwaitExpressionSyntax)
GetCollectionInitializerSymbolInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Returns what 'Add' method symbol(s), if any, corresponds to the given expression syntax within Initializer.

GetCompilationUnitRoot(SyntaxTree, CancellationToken)
GetConstantValue(SemanticModel, ExpressionSyntax, CancellationToken)
GetConversion(IConversionOperation)

Gets the underlying Conversion information from this IConversionOperation. This IConversionOperation must have been created from CSharp code.

GetConversion(SemanticModel, SyntaxNode, CancellationToken)
GetDeclaredSymbol(SemanticModel, AccessorDeclarationSyntax, CancellationToken)

Given a syntax node that declares a property or member accessor, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, AnonymousObjectCreationExpressionSyntax, CancellationToken)

Given a syntax node of anonymous object creation expression, get the anonymous object type symbol.

GetDeclaredSymbol(SemanticModel, AnonymousObjectMemberDeclaratorSyntax, CancellationToken)

Given a syntax node of anonymous object creation initializer, get the anonymous object property symbol.

GetDeclaredSymbol(SemanticModel, ArgumentSyntax, CancellationToken)

Given a syntax node of a tuple argument, get the tuple element symbol.

GetDeclaredSymbol(SemanticModel, BaseMethodDeclarationSyntax, CancellationToken)

Given a base method declaration syntax, get the corresponding method symbol.

GetDeclaredSymbol(SemanticModel, BasePropertyDeclarationSyntax, CancellationToken)

Given a syntax node that declares a property, indexer or an event, get the corresponding declared symbol.

GetDeclaredSymbol(SemanticModel, BaseTypeDeclarationSyntax, CancellationToken)

Given a type declaration, get the corresponding type symbol.

GetDeclaredSymbol(SemanticModel, CatchDeclarationSyntax, CancellationToken)

Given a catch declaration, get the symbol for the exception variable

GetDeclaredSymbol(SemanticModel, CompilationUnitSyntax, CancellationToken)

Given a compilation unit syntax, get the corresponding Simple Program entry point symbol.

GetDeclaredSymbol(SemanticModel, DelegateDeclarationSyntax, CancellationToken)

Given a delegate declaration, get the corresponding type symbol.

GetDeclaredSymbol(SemanticModel, EnumMemberDeclarationSyntax, CancellationToken)

Given a enum member declaration, get the corresponding field symbol.

GetDeclaredSymbol(SemanticModel, EventDeclarationSyntax, CancellationToken)

Given a syntax node that declares a (custom) event, get the corresponding event symbol.

GetDeclaredSymbol(SemanticModel, ExternAliasDirectiveSyntax, CancellationToken)

Given an extern alias declaration get the corresponding symbol for the alias that was introduced.

GetDeclaredSymbol(SemanticModel, FileScopedNamespaceDeclarationSyntax, CancellationToken)

Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly.

GetDeclaredSymbol(SemanticModel, ForEachStatementSyntax, CancellationToken)

Given a foreach statement, get the symbol for the iteration variable

GetDeclaredSymbol(SemanticModel, IndexerDeclarationSyntax, CancellationToken)

Given a syntax node that declares an indexer, get the corresponding declared symbol.

GetDeclaredSymbol(SemanticModel, JoinIntoClauseSyntax, CancellationToken)

Get the query range variable declared in a join into clause.

GetDeclaredSymbol(SemanticModel, LabeledStatementSyntax, CancellationToken)

Given a labeled statement syntax, get the corresponding label symbol.

GetDeclaredSymbol(SemanticModel, LocalFunctionStatementSyntax, CancellationToken)

Given a local function declaration syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, MemberDeclarationSyntax, CancellationToken)

Given a member declaration syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, NamespaceDeclarationSyntax, CancellationToken)

Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly.

GetDeclaredSymbol(SemanticModel, ParameterSyntax, CancellationToken)

Given a parameter declaration syntax node, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, PropertyDeclarationSyntax, CancellationToken)

Given a syntax node that declares a property, get the corresponding declared symbol.

GetDeclaredSymbol(SemanticModel, QueryClauseSyntax, CancellationToken)
GetDeclaredSymbol(SemanticModel, QueryContinuationSyntax, CancellationToken)

Get the query range variable declared in a query continuation clause.

GetDeclaredSymbol(SemanticModel, SingleVariableDesignationSyntax, CancellationToken)

Given a variable declarator syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, SwitchLabelSyntax, CancellationToken)

Given a switch label syntax, get the corresponding label symbol.

GetDeclaredSymbol(SemanticModel, TupleElementSyntax, CancellationToken)

Given a tuple element syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, TupleExpressionSyntax, CancellationToken)

Given a syntax node of tuple expression, get the tuple type symbol.

GetDeclaredSymbol(SemanticModel, TypeParameterSyntax, CancellationToken)

Given a type parameter declaration (field or method), get the corresponding symbol

GetDeclaredSymbol(SemanticModel, UsingDirectiveSyntax, CancellationToken)

Given a using declaration get the corresponding symbol for the using alias that was introduced.

GetDeclaredSymbol(SemanticModel, VariableDeclaratorSyntax, CancellationToken)

Given a variable declarator syntax, get the corresponding symbol.

GetDeconstructionInfo(SemanticModel, AssignmentExpressionSyntax)
GetDeconstructionInfo(SemanticModel, ForEachVariableStatementSyntax)
GetElementConversion(ISpreadOperation)

Gets the underlying element Conversion information from this ISpreadOperation.

GetFirstDirective(SyntaxNode, Func<DirectiveTriviaSyntax,Boolean>)

Gets the first directive of the tree rooted by this node.

GetForEachStatementInfo(SemanticModel, CommonForEachStatementSyntax)
GetForEachStatementInfo(SemanticModel, ForEachStatementSyntax)
GetInConversion(ICompoundAssignmentOperation)

Gets the underlying Conversion information from this ICompoundAssignmentOperation. This conversion is applied before the operator is applied to the result of this conversion and Value.

GetIndexerGroup(SemanticModel, ExpressionSyntax, CancellationToken)

Returns the list of accessible, non-hidden indexers that could be invoked with the given expression as receiver.

GetLastDirective(SyntaxNode, Func<DirectiveTriviaSyntax,Boolean>)

Gets the last directive of the tree rooted by this node.

GetMemberGroup(SemanticModel, AttributeSyntax, CancellationToken)
GetMemberGroup(SemanticModel, ConstructorInitializerSyntax, CancellationToken)
GetMemberGroup(SemanticModel, ExpressionSyntax, CancellationToken)
GetOutConversion(ICompoundAssignmentOperation)

Gets the underlying Conversion information from this ICompoundAssignmentOperation. This conversion is applied after the operator is applied, before the result is assigned to Target.

GetQueryClauseInfo(SemanticModel, QueryClauseSyntax, CancellationToken)

Gets the semantic information associated with a query clause.

GetSpeculativeAliasInfo(SemanticModel, Int32, IdentifierNameSyntax, SpeculativeBindingOption)

Binds the name in the context of the specified location and sees if it resolves to an alias name. If it does, return the AliasSymbol corresponding to it. Otherwise, return null.

GetSpeculativeConversion(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)
GetSpeculativeSymbolInfo(SemanticModel, Int32, AttributeSyntax)

Bind the attribute in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about an attribute that did not actually appear in the source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, ConstructorInitializerSyntax)

Bind the constructor initializer in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about a constructor initializer that did not actually appear in the source code.

NOTE: This will only work in locations where there is already a constructor initializer.

GetSpeculativeSymbolInfo(SemanticModel, Int32, CrefSyntax, SpeculativeBindingOption)

Binds the CrefSyntax expression in the context of the specified location and gets symbol information. This method is used to get symbol information about an expression that did not actually appear in the source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)

Binds the expression in the context of the specified location and gets symbol information. This method is used to get symbol information about an expression that did not actually appear in the source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, PrimaryConstructorBaseTypeSyntax)

Bind the constructor initializer in the context of the specified location and get semantic information about symbols. This method is used to get semantic information about a constructor initializer that did not actually appear in the source code.

NOTE: This will only work in locations where there is already a constructor initializer. PrimaryConstructorBaseTypeSyntax.

GetSpeculativeTypeInfo(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)

Binds the expression in the context of the specified location and gets type information. This method is used to get type information about an expression that did not actually appear in the source code.

GetSymbolInfo(SemanticModel, AttributeSyntax, CancellationToken)

Returns what symbol(s), if any, the given attribute syntax bound to in the program.

GetSymbolInfo(SemanticModel, ConstructorInitializerSyntax, CancellationToken)

Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program.

GetSymbolInfo(SemanticModel, CrefSyntax, CancellationToken)

Gets the semantic information associated with a documentation comment cref.

GetSymbolInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Returns what symbol(s), if any, the given expression syntax bound to in the program.

An AliasSymbol will never be returned by this method. What the alias refers to will be returned instead. To get information about aliases, call GetAliasInfo.

If binding the type name C in the expression "new C(...)" the actual constructor bound to will be returned (or all constructor if overload resolution failed). This occurs as long as C unambiguously binds to a single type that has a constructor. If C ambiguously binds to multiple types, or C binds to a static class, then type(s) are returned.

GetSymbolInfo(SemanticModel, OrderingSyntax, CancellationToken)

Gets the semantic information for an ordering clause in an orderby query clause.

GetSymbolInfo(SemanticModel, PrimaryConstructorBaseTypeSyntax, CancellationToken)

Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program.

GetSymbolInfo(SemanticModel, SelectOrGroupClauseSyntax, CancellationToken)

Gets the semantic information associated with a select or group clause.

GetTypeInfo(SemanticModel, AttributeSyntax, CancellationToken)

Gets type information about an attribute.

GetTypeInfo(SemanticModel, ConstructorInitializerSyntax, CancellationToken)

Gets type information about a constructor initializer.

GetTypeInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Gets type information about an expression.

GetTypeInfo(SemanticModel, SelectOrGroupClauseSyntax, CancellationToken)
Insert(SyntaxTokenList, Int32, SyntaxToken[])

Insert one or more tokens in the list at the specified index.

IsContextualKeyword(SyntaxToken)
IsKeyword(SyntaxToken)
IsReservedKeyword(SyntaxToken)
IsVerbatimIdentifier(SyntaxToken)
IsVerbatimStringLiteral(SyntaxToken)
Kind(SyntaxNode)

Returns SyntaxKind for SyntaxNode from RawKind property.

Kind(SyntaxNodeOrToken)

Returns SyntaxKind for SyntaxNode from RawKind property.

Kind(SyntaxToken)

Returns SyntaxKind for SyntaxToken from RawKind property.

Kind(SyntaxTrivia)

Returns SyntaxKind for SyntaxTrivia from RawKind property.

ReplaceTrivia(SyntaxToken, IEnumerable<SyntaxTrivia>, Func<SyntaxTrivia,SyntaxTrivia,SyntaxTrivia>)

Creates a new token with the specified old trivia replaced with computed new trivia.

ReplaceTrivia(SyntaxToken, SyntaxTrivia, SyntaxTrivia)

Creates a new token with the specified old trivia replaced with a new trivia. The old trivia may appear in the token's leading or trailing trivia.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, ArrowExpressionClauseSyntax, SemanticModel)

Get a SemanticModel object that is associated with an expression body that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an expression body that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, AttributeSyntax, SemanticModel)

Get a SemanticModel object that is associated with an attribute that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an attribute that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, ConstructorInitializerSyntax, SemanticModel)

Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code.

NOTE: This will only work in locations where there is already a constructor initializer.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, CrefSyntax, SemanticModel)

Get a SemanticModel object that is associated with a cref syntax node that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a cref syntax that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, EqualsValueClauseSyntax, SemanticModel)

Get a SemanticModel object that is associated with an initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a field initializer or default parameter value that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, PrimaryConstructorBaseTypeSyntax, SemanticModel)

Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code.

NOTE: This will only work in locations where there is already a constructor initializer.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, StatementSyntax, SemanticModel)

Get a SemanticModel object that is associated with a statement that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a statement that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, TypeSyntax, SemanticModel, SpeculativeBindingOption)

Get a SemanticModel object that is associated with a type syntax node that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a type syntax that did not appear in source code.

TryGetSpeculativeSemanticModelForMethodBody(SemanticModel, Int32, AccessorDeclarationSyntax, SemanticModel)

Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given position must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body.

TryGetSpeculativeSemanticModelForMethodBody(SemanticModel, Int32, BaseMethodDeclarationSyntax, SemanticModel)

Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given position must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body.

VarianceKindFromToken(SyntaxToken)

Applies to