Click or drag to resize

CSharpExtensions Class



Inheritance Hierarchy
SystemObject
  Microsoft.CodeAnalysis.CSharpCSharpExtensions

Namespace:  Microsoft.CodeAnalysis.CSharp
Assembly:  Microsoft.CodeAnalysis.CSharp (in Microsoft.CodeAnalysis.CSharp.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public static class CSharpExtensions

The CSharpExtensions type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAnalyzeControlFlow(SemanticModel, StatementSyntax)
Analyze control-flow within a part of a method body.
Public methodStatic memberAnalyzeControlFlow(SemanticModel, StatementSyntax, StatementSyntax)
Analyze control-flow within a part of a method body.
Public methodStatic memberAnalyzeDataFlow(SemanticModel, ExpressionSyntax)
Analyze data-flow within an expression.
Public methodStatic memberAnalyzeDataFlow(SemanticModel, StatementSyntax)
Analyze data-flow within a part of a method body.
Public methodStatic memberAnalyzeDataFlow(SemanticModel, StatementSyntax, StatementSyntax)
Analyze data-flow within a part of a method body.
Public methodStatic memberClassifyConversion(Compilation, ITypeSymbol, ITypeSymbol)
Public methodStatic memberClassifyConversion(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.
Public methodStatic memberClassifyConversion(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.
Public methodStatic memberGetAliasInfo
If nameSyntax resolves to an alias name, return the AliasSymbol corresponding to A. Otherwise return null.
Public methodStatic memberGetAwaitExpressionInfo
Public methodStatic memberGetCollectionInitializerSymbolInfo
Returns what 'Add' method symbol(s), if any, corresponds to the given expression syntax within Initializer.
Public methodStatic memberGetCompilationUnitRoot
Public methodStatic memberGetConstantValue
Public methodStatic memberGetConversion
Public methodStatic memberGetDeclaredSymbol(SemanticModel, AccessorDeclarationSyntax, CancellationToken)
Given a syntax node that declares a property or member accessor, get the corresponding symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, AnonymousObjectCreationExpressionSyntax, CancellationToken)
Given a syntax node of anonymous object creation expression, get the anonymous object type symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, AnonymousObjectMemberDeclaratorSyntax, CancellationToken)
Given a syntax node of anonymous object creation initializer, get the anonymous object property symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, ArgumentSyntax, CancellationToken)
Given a syntax node of a tuple argument, get the tuple element symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, BaseMethodDeclarationSyntax, CancellationToken)
Given a base method declaration syntax, get the corresponding method symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, BasePropertyDeclarationSyntax, CancellationToken)
Given a syntax node that declares a property, indexer or an event, get the corresponding declared symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, BaseTypeDeclarationSyntax, CancellationToken)
Given a type declaration, get the corresponding type symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, CatchDeclarationSyntax, CancellationToken)
Given a catch declaration, get the symbol for the exception variable
Public methodStatic memberGetDeclaredSymbol(SemanticModel, DelegateDeclarationSyntax, CancellationToken)
Given a delegate declaration, get the corresponding type symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, EnumMemberDeclarationSyntax, CancellationToken)
Given a enum member declaration, get the corresponding field symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, EventDeclarationSyntax, CancellationToken)
Given a syntax node that declares a (custom) event, get the corresponding event symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, ExternAliasDirectiveSyntax, CancellationToken)
Given an extern alias declaration get the corresponding symbol for the alias that was introduced.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, ForEachStatementSyntax, CancellationToken)
Given a foreach statement, get the symbol for the iteration variable
Public methodStatic memberGetDeclaredSymbol(SemanticModel, IndexerDeclarationSyntax, CancellationToken)
Given a syntax node that declares an indexer, get the corresponding declared symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, JoinIntoClauseSyntax, CancellationToken)
Get the query range variable declared in a join into clause.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, LabeledStatementSyntax, CancellationToken)
Given a labeled statement syntax, get the corresponding label symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, MemberDeclarationSyntax, CancellationToken)
Given a member declaration syntax, get the corresponding symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, NamespaceDeclarationSyntax, CancellationToken)
Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, ParameterSyntax, CancellationToken)
Given a parameter declaration syntax node, get the corresponding symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, PropertyDeclarationSyntax, CancellationToken)
Given a syntax node that declares a property, get the corresponding declared symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, QueryClauseSyntax, CancellationToken)
Public methodStatic memberGetDeclaredSymbol(SemanticModel, QueryContinuationSyntax, CancellationToken)
Get the query range variable declared in a query continuation clause.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, SingleVariableDesignationSyntax, CancellationToken)
Given a variable declarator syntax, get the corresponding symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, SwitchLabelSyntax, CancellationToken)
Given a switch label syntax, get the corresponding label symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, TupleElementSyntax, CancellationToken)
Given a tuple element syntax, get the corresponding symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, TupleExpressionSyntax, CancellationToken)
Given a syntax node of tuple expression, get the tuple type symbol.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, TypeParameterSyntax, CancellationToken)
Given a type parameter declaration (field or method), get the corresponding symbol
Public methodStatic memberGetDeclaredSymbol(SemanticModel, UsingDirectiveSyntax, CancellationToken)
Given a using declaration get the corresponding symbol for the using alias that was introduced.
Public methodStatic memberGetDeclaredSymbol(SemanticModel, VariableDeclaratorSyntax, CancellationToken)
Given a variable declarator syntax, get the corresponding symbol.
Public methodStatic memberGetFirstDirective
Public methodStatic memberGetForEachStatementInfo(SemanticModel, CommonForEachStatementSyntax)
Public methodStatic memberGetForEachStatementInfo(SemanticModel, ForEachStatementSyntax)
Public methodStatic memberGetIndexerGroup
Returns the list of accessible, non-hidden indexers that could be invoked with the given expression as receiver.
Public methodStatic memberGetLastDirective
Public methodStatic memberGetMemberGroup(SemanticModel, AttributeSyntax, CancellationToken)
Public methodStatic memberGetMemberGroup(SemanticModel, ConstructorInitializerSyntax, CancellationToken)
Public methodStatic memberGetMemberGroup(SemanticModel, ExpressionSyntax, CancellationToken)
Public methodStatic memberGetQueryClauseInfo
Gets the semantic information associated with a query clause.
Public methodStatic memberGetSpeculativeAliasInfo
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.
Public methodStatic memberGetSpeculativeConversion
Public methodStatic memberGetSpeculativeSymbolInfo(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.
Public methodStatic memberGetSpeculativeSymbolInfo(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.
Public methodStatic memberGetSpeculativeSymbolInfo(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.
Public methodStatic memberGetSpeculativeSymbolInfo(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.
Public methodStatic memberGetSpeculativeTypeInfo
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.
Public methodStatic memberGetSymbolInfo(SemanticModel, AttributeSyntax, CancellationToken)
Returns what symbol(s), if any, the given attribute syntax bound to in the program.
Public methodStatic memberGetSymbolInfo(SemanticModel, ConstructorInitializerSyntax, CancellationToken)
Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program.
Public methodStatic memberGetSymbolInfo(SemanticModel, CrefSyntax, CancellationToken)
Gets the semantic information associated with a documentation comment cref.
Public methodStatic memberGetSymbolInfo(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.
Public methodStatic memberGetSymbolInfo(SemanticModel, OrderingSyntax, CancellationToken)
Gets the semantic information for an ordering clause in an orderby query clause.
Public methodStatic memberGetSymbolInfo(SemanticModel, SelectOrGroupClauseSyntax, CancellationToken)
Gets the semantic information associated with a select or group clause.
Public methodStatic memberGetTypeInfo(SemanticModel, AttributeSyntax, CancellationToken)
Gets type information about an attribute.
Public methodStatic memberGetTypeInfo(SemanticModel, ConstructorInitializerSyntax, CancellationToken)
Gets type information about a constructor initializer.
Public methodStatic memberGetTypeInfo(SemanticModel, ExpressionSyntax, CancellationToken)
Gets type information about an expression.
Public methodStatic memberGetTypeInfo(SemanticModel, SelectOrGroupClauseSyntax, CancellationToken)
Public methodStatic memberInsert
Insert one or more tokens in the list at the specified index.
Public methodStatic memberIsContextualKeyword
Public methodStatic memberIsKeyword
Public methodStatic memberIsReservedKeyword
Public methodStatic memberIsVerbatimIdentifier
Public methodStatic memberIsVerbatimStringLiteral
Public methodStatic memberKind(SyntaxNode)
Public methodStatic memberKind(SyntaxNodeOrToken)
Public methodStatic memberKind(SyntaxToken)
Public methodStatic memberKind(SyntaxTrivia)
Public methodStatic memberReplaceTrivia(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.
Public methodStatic memberReplaceTrivia(SyntaxToken, IEnumerableT, Void)
Public methodStatic memberTryGetSpeculativeSemanticModel(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.
Public methodStatic memberTryGetSpeculativeSemanticModel(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.
Public methodStatic memberTryGetSpeculativeSemanticModel(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.
Public methodStatic memberTryGetSpeculativeSemanticModel(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.
Public methodStatic memberTryGetSpeculativeSemanticModel(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.
Public methodStatic memberTryGetSpeculativeSemanticModel(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.
Public methodStatic memberTryGetSpeculativeSemanticModel(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.
Public methodStatic memberTryGetSpeculativeSemanticModelForMethodBody(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.
Public methodStatic memberTryGetSpeculativeSemanticModelForMethodBody(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.
Public methodStatic memberVarianceKindFromToken
Top
See Also