Base:
property
Body
Microsoft.CodeAnalysis.CSharp.Syntax.BaseMethodDeclarationSyntax.Body
79 references to Body
Microsoft.CodeAnalysis.CSharp (17)
_generated\0\Syntax.xml.Main.Generated.cs (1)
2071=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken));
_generated\2\Syntax.xml.Syntax.Generated.cs (13)
12413if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) 12424public new MethodDeclarationSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12426public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12427public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12428public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12429public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12430public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12432public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12433public MethodDeclarationSyntax WithConstraintClauses(SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); 12437public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); 12439public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); 12456var body = this.Body ?? SyntaxFactory.Block(); 12462var body = this.Body ?? SyntaxFactory.Block();
Binder\LocalBinderFactory.cs (1)
149Visit(node.Body);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (2)
60isIterator: SyntaxFacts.HasYieldOperations(syntax.Body), 86syntax.Body, syntax.ExpressionBody, syntax, diagnostics);
Microsoft.CodeAnalysis.CSharp.Analyzers (4)
MetaAnalyzers\Fixers\CSharpConfigureGeneratedCodeAnalysisFix.cs (2)
28else if (method.Body != null) 30return method.Body.Statements;
MetaAnalyzers\Fixers\CSharpEnableConcurrentExecutionFix.cs (2)
28else if (method.Body != null) 30return method.Body.Statements;
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
62methodDeclaration.Body == null) 142if (member is MethodDeclarationSyntax { Body: null, ExpressionBody: null })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (1)
34=> declaration.Body;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
228else if (method is { Body: not null })
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (1)
27if (method.Body != null || method.ExpressionBody != null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
188if (methodDeclaration.Body?.TryConvertToArrowExpressionBody(
Microsoft.CodeAnalysis.CSharp.Features (32)
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (1)
79return declarations.Any(d => d.Body == null && d.Modifiers.Any(SyntaxKind.PartialKeyword));
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (6)
159if (methodDeclaration.Body is not BlockSyntax block) 226Contract.ThrowIfNull(methodDeclaration.Body); // checked by analyzer 229if (methodDeclaration.Body.Statements.Count > 0) 230statements.AddRange(methodDeclaration.Body.Statements[0].WithPrependedLeadingTrivia(methodDeclaration.GetLeadingTrivia())); 232statements.AddRange(methodDeclaration.Body.Statements.Skip(1)); 245body: otherMethod.Body,
EditAndContinue\SyntaxUtilities.cs (1)
24MethodDeclarationSyntax methodDeclaration => CreateSimpleBody(BlockOrExpression(methodDeclaration.Body, methodDeclaration.ExpressionBody)),
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
1024=> TweakNewLinesInMethod(method, method.Body, method.ExpressionBody);
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (1)
125MethodDeclarationSyntax methodDeclaration => (methodDeclaration.Body, methodDeclaration.ExpressionBody, methodDeclaration.SemicolonToken),
LineSeparators\CSharpLineSeparatorService.cs (3)
130if (methodDecl.Body != null && 131(methodDecl.Body.OpenBraceToken.IsMissing || 132methodDecl.Body.CloseBraceToken.IsMissing))
Organizing\Organizers\MethodDeclarationOrganizer.cs (1)
38body: syntax.Body,
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (4)
226if (getMethodDeclaration.Body != null) 228return accessor.WithBody(getMethodDeclaration.Body.WithAdditionalAnnotations(Formatter.Annotation)); 274if (setMethodDeclaration.Body != null) 276var body = ReplaceReferencesToParameterWithValue(semanticModel, setMethod.Parameters[0], setMethodDeclaration.Body);
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (2)
266if (methodDeclaration.Body != null && expressionBodyPreference != ExpressionBodyPreference.Never) 268if (methodDeclaration.Body.TryConvertToArrowExpressionBody(
Snippets\CSharpIntMainSnippetProvider.cs (2)
41var body = methodDeclaration.Body!; 54var body = methodDeclaration.Body!;
Snippets\CSharpVoidMainSnippetProvider.cs (2)
39static d => d.Body!, 46static m => m.Body!,
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
62methodDeclaration.Body == null) 142if (member is MethodDeclarationSyntax { Body: null, ExpressionBody: null })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (1)
34=> declaration.Body;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
228else if (method is { Body: not null })
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (1)
27if (method.Body != null || method.ExpressionBody != null)
Structure\Providers\MethodDeclarationStructureProvider.cs (3)
24if (methodDeclaration.Body == null || 25methodDeclaration.Body.OpenBraceToken.IsMissing || 26methodDeclaration.Body.CloseBraceToken.IsMissing)
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
2624SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).Body?.Statements,
Rename\LocalConflictVisitor.cs (1)
43Visit(node.Body);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
188if (methodDeclaration.Body?.TryConvertToArrowExpressionBody(
Microsoft.DotNet.GenFacades (1)
NotSupportedAssemblyGenerator.cs (1)
115if (node.Body == null)
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
314CSharpSyntaxNode? methodBody = method.Body as CSharpSyntaxNode ?? method.ExpressionBody;
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
EmitterTests.cs (2)
66.Body! 95.Body!
Microsoft.Gen.Logging (2)
Parsing\Parser.cs (2)
409if (method.Body != null) 411Diag(DiagDescriptors.LoggingMethodHasBody, method.Body.GetLocation());
Microsoft.Gen.MetadataExtractor (1)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (1)
495if (methodSyntax.Body != null)
Microsoft.Gen.Metrics (1)
Parser.cs (1)
495if (methodSyntax.Body != null)
Microsoft.Gen.MetricsReports (1)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (1)
495if (methodSyntax.Body != null)
Microsoft.Interop.ComInterfaceGenerator (2)
Analyzers\VtableIndexStubDiagnosticsAnalyzer.cs (1)
112|| methodSyntax.Body is not null
ComMethodInfo.cs (1)
71|| comMethodDeclaringSyntax.Body is not null
Microsoft.Interop.JavaScript.JSImportGenerator (1)
Analyzers\JSImportExportDiagnosticsAnalyzer.cs (1)
156bool hasImplementation = methodSyntax.Body is not null || methodSyntax.ExpressionBody is not null;
Microsoft.Interop.LibraryImportGenerator (2)
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (2)
127if (methodSyntax.Body is not null && isGeneratedByOurGenerator) 323|| methodSyntax.Body is not null
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (2)
129if (methodSyntax.Body is not null && isGeneratedByOurGenerator) 327|| methodSyntax.Body is not null
Roslyn.Diagnostics.CSharp.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
188if (methodDeclaration.Body?.TryConvertToArrowExpressionBody(