95 references to Else
Microsoft.CodeAnalysis.CSharp (13)
_generated\0\Syntax.xml.Main.Generated.cs (1)
1927=> node.Update(VisitList(node.AttributeLists), VisitToken(node.IfKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement"), (ElseClauseSyntax?)Visit(node.Else));
_generated\2\Syntax.xml.Syntax.Generated.cs (7)
8418if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) 8429public new IfStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); 8430public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); 8431public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); 8432public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else); 8433public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else); 8434public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else);
Binder\Binder_Statements.cs (2)
2594if (node.Else == null) 2600var elseStatementSyntax = node.Else.Statement;
Binder\LocalBinderFactory.cs (2)
822if (node.Else == null) 827var elseStatementSyntax = node.Else.Statement;
Syntax\LookupPosition.cs (1)
457ElseClauseSyntax? elseOpt = ifStmt.Else;
Microsoft.CodeAnalysis.CSharp.CodeStyle (15)
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
127var elseNode = ifStatementNode.Else; 295var elseStatement = statement.Else?.Statement;
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
61if (ifStatement.Else != null)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (1)
67=> ifStatement.Else != null;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUpdateExpressionSyntaxHelper.cs (2)
43whenFalseStatements = ifStatement.Else != null ? ExtractEmbeddedStatements(ifStatement.Else.Statement) : null;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
128if (ifStatement.Else != null)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (1)
97if (ifStatement.Else == null)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
176? ifStatement.Else?.Statement
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (3)
42if (ifStatementNode.Else != null) 44AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.Else.ElseKeyword, ifStatementNode.Else.Statement.GetLastToken(includeZeroWidth: true));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (3)
127if (ifStatementNode?.Else != null) 129RemoveSuppressOperation(list, ifStatementNode.Else.ElseKeyword, ifStatementNode.Else.Statement.GetFirstToken(includeZeroWidth: true));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (4)
568if (ifStatement.Else is null) 581var falseStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.Else.Statement); 853if (ifStatement.Else != null) 854yield return UnwrapEmbeddedStatement(ifStatement.Else.Statement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionHelpers.cs (3)
33if (ifStatement.Else is null || !ifStatement.Else.ElseKeyword.LeadingTrivia.Any(t => t.IsSingleOrMultiLineComment())) 37.WithColonToken(ColonToken.WithPrependedLeadingTrivia(ifStatement.Else.ElseKeyword.LeadingTrivia))
Microsoft.CodeAnalysis.CSharp.Features (38)
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
108if (ifStatement.Else == null)
Debugging\CSharpProximityExpressionsService.Worker.cs (2)
261if (ifStatement.Else != null) 263AddLastStatementOfConstruct(ifStatement.Else.Statement);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
175.WithElse(VisitNode(node.Else));
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (3)
46while (ifStatement != null && ifStatement.Else != null) 49var elseKeyword = ifStatement.Else.ElseKeyword; 51if (ifStatement.Else.Statement is IfStatementSyntax elseIfStatement)
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (4)
39=> ifNode.Else == null; 72=> ifNode.Else?.Statement ?? throw new InvalidOperationException(); 168var elseClause = updatedIf.Else != null 169? updatedIf.Else.WithStatement(falseStatementOpt)
SplitOrMergeIfStatements\CSharpIfLikeStatementGenerator.cs (9)
58if (ifStatement.Else?.Statement is IfStatementSyntax elseIfStatement) 92while (ifStatement.Else?.Statement is IfStatementSyntax elseIfStatement) 98if (ifStatement.Else != null) 100builder.Add(ifStatement.Else); 126=> ((IfStatementSyntax)ifStatement).WithElse(((IfStatementSyntax)otherIfStatement).Else); 141var newElseIfStatement = elseIfStatement.WithElse(ifStatement.Else); 144if (ifStatement.Else == null && ContainsEmbeddedIfStatement(ifStatement)) 161var elseClause = parentIfStatement.Else; 163return parentIfStatement.WithElse(elseIfStatement.Else);
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
127var elseNode = ifStatementNode.Else; 295var elseStatement = statement.Else?.Statement;
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
61if (ifStatement.Else != null)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (1)
67=> ifStatement.Else != null;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUpdateExpressionSyntaxHelper.cs (2)
43whenFalseStatements = ifStatement.Else != null ? ExtractEmbeddedStatements(ifStatement.Else.Statement) : null;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
128if (ifStatement.Else != null)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (1)
97if (ifStatement.Else == null)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
176? ifStatement.Else?.Statement
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (4)
568if (ifStatement.Else is null) 581var falseStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.Else.Statement); 853if (ifStatement.Else != null) 854yield return UnwrapEmbeddedStatement(ifStatement.Else.Statement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionHelpers.cs (3)
33if (ifStatement.Else is null || !ifStatement.Else.ElseKeyword.LeadingTrivia.Any(t => t.IsSingleOrMultiLineComment())) 37.WithColonToken(ColonToken.WithPrependedLeadingTrivia(ifStatement.Else.ElseKeyword.LeadingTrivia))
Structure\Providers\BlockSyntaxStructureProvider.cs (2)
44for (var currentElse = ifStatement.Else; currentElse != null;) 50currentElse = nextIfStatement.Else;
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (9)
Microsoft.NetCore.Analyzers\Performance\CSharpDoNotGuardCall.Fixer.cs (3)
34? ifStatementSyntax.Else?.Statement.ChildNodes().Count() == 1 45if (conditionalOperationNode is IfStatementSyntax { Else: not null } ifStatementSyntax) 52.WithStatement(guardedCallInElse ? ifStatementSyntax.Statement : ifStatementSyntax.Else.Statement)
Microsoft.NetCore.Analyzers\Performance\CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs (6)
235if (ifStatement.Else is null) 247editor.ReplaceNode(ifStatement.Statement, ifStatement.Else.Statement); 248editor.RemoveNode(ifStatement.Else, SyntaxRemoveOptions.KeepNoTrivia); 259else if (ifStatement.Condition.IsKind(SyntaxKind.InvocationExpression) && ifStatement.Else is not null) 263if (ifStatement.Else.Statement is BlockSyntax { Statements.Count: 1 } or ExpressionStatementSyntax) 267editor.RemoveNode(ifStatement.Else);
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (3)
42if (ifStatementNode.Else != null) 44AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.Else.ElseKeyword, ifStatementNode.Else.Statement.GetLastToken(includeZeroWidth: true));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (3)
127if (ifStatementNode?.Else != null) 129RemoveSuppressOperation(list, ifStatementNode.Else.ElseKeyword, ifStatementNode.Else.Statement.GetFirstToken(includeZeroWidth: true));
Roslyn.Diagnostics.CSharp.Analyzers (6)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (3)
42if (ifStatementNode.Else != null) 44AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.Else.ElseKeyword, ifStatementNode.Else.Statement.GetLastToken(includeZeroWidth: true));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (3)
127if (ifStatementNode?.Else != null) 129RemoveSuppressOperation(list, ifStatementNode.Else.ElseKeyword, ifStatementNode.Else.Statement.GetFirstToken(includeZeroWidth: true));
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
586if (HandleConditionalCase(ifStatement.Condition, ifStatement.Statement, ifStatement.Else))