1 instantiation of PropertyDeclarationSyntax
Microsoft.CodeAnalysis.CSharp (1)
_generated\1\Syntax.xml.Internal.Generated.cs (1)
21214internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position);
490 references to PropertyDeclarationSyntax
EventSourceGenerator (1)
EventSourceGenerator.Parser.cs (1)
132if (member is PropertyDeclarationSyntax prop && prop.Identifier.Text == "ProviderMetadata")
ILLink.CodeFixProvider (8)
BaseAttributeCodeFixProvider.cs (2)
103case PropertyDeclarationSyntax when targets.HasFlag(AttributeableParentTargets.Property): 106case PropertyDeclarationSyntax:
RequiresUnsafeCodeFixProvider.cs (6)
149or PropertyDeclarationSyntax 160PropertyDeclarationSyntax property => property.Modifiers.Any(SyntaxKind.UnsafeKeyword), 440else if (parent is AccessorDeclarationSyntax or PropertyDeclarationSyntax or IndexerDeclarationSyntax) 485case PropertyDeclarationSyntax propDecl: 489var newProp = propDecl 564else if (arrowExpr.Parent is PropertyDeclarationSyntax prop)
Microsoft.AspNetCore.App.Analyzers (1)
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
234=> node?.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Initializer == node;
Microsoft.AspNetCore.Components.Analyzers (9)
ComponentParameterAnalyzer.cs (1)
152symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) is PropertyDeclarationSyntax syntax &&
ComponentParametersShouldBePublicCodeFixProvider.cs (4)
38var declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<PropertyDeclarationSyntax>().First(); 53PropertyDeclarationSyntax declarationNode) 60private static SyntaxNode HandlePropertyDeclaration(PropertyDeclarationSyntax node)
PersistentStateAnalyzer.cs (2)
40var propertyDeclaration = (PropertyDeclarationSyntax)context.Node;
SupplyParameterFromFormAnalyzer.cs (2)
40var propertyDeclaration = (PropertyDeclarationSyntax)context.Node;
Microsoft.AspNetCore.Components.SdkAnalyzers (4)
ComponentParametersShouldBePublicCodeFixProvider.cs (4)
38var declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<PropertyDeclarationSyntax>().First(); 53PropertyDeclarationSyntax declarationNode) 60private static SyntaxNode HandlePropertyDeclaration(PropertyDeclarationSyntax node)
Microsoft.CodeAnalysis.CSharp (69)
_generated\0\Syntax.xml.Main.Generated.cs (8)
597public virtual TResult? VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); 1349public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); 2100public override SyntaxNode? VisitPropertyDeclaration(PropertyDeclarationSyntax node) 5668public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) 5678return (PropertyDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.PropertyDeclaration(attributeLists.Node.ToGreenList<Syntax.InternalSyntax.AttributeListSyntax>(), modifiers.Node.ToGreenList<Syntax.InternalSyntax.SyntaxToken>(), (Syntax.InternalSyntax.TypeSyntax)type.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, accessorList == null ? null : (Syntax.InternalSyntax.AccessorListSyntax)accessorList.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, initializer == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)initializer.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); 5682public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer) 5686public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, SyntaxToken identifier) 5690public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, string identifier)
_generated\2\Syntax.xml.Syntax.Generated.cs (14)
13337public PropertyDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) 13341var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); 13350public new PropertyDeclarationSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); 13352public new PropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); 13354public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); 13356public new PropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); 13357public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); 13359public new PropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); 13360public PropertyDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, expressionBody, this.Initializer, this.SemicolonToken); 13361public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, initializer, this.SemicolonToken); 13362public PropertyDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, semicolonToken); 13365public new PropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); 13367public new PropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); 13369public new PropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items)
Binder\Binder_Statements.cs (1)
3620PropertyDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedProperty,
Binder\BinderFactory.BinderFactoryVisitor.cs (3)
388public override Binder VisitPropertyDeclaration(PropertyDeclarationSyntax parent) 493var propertyDecl = (PropertyDeclarationSyntax)basePropertyDeclarationSyntax;
Compilation\CSharpSemanticModel.cs (1)
3035public abstract IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken));
Compilation\InitializerSemanticModel.cs (2)
101rootSyntax = ((PropertyDeclarationSyntax)rootSyntax).Initializer; 126equalsValue = ((PropertyDeclarationSyntax)node).Initializer;
Compilation\MemberSemanticModel.cs (1)
651public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
305public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (7)
932var propertyDecl = (PropertyDeclarationSyntax)memberDecl; 1137var propertyDecl = (PropertyDeclarationSyntax)node.Parent; 1557public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1661var propertyDecl = (PropertyDeclarationSyntax)declaration;
CSharpExtensions.cs (1)
1451public static IPropertySymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
602PropertyDeclarationSyntax propertySyntax = (PropertyDeclarationSyntax)syntax;
Lowering\Instrumentation\DebugInfoInjector.cs (2)
150var declaration = (PropertyDeclarationSyntax)grandparent;
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (1)
28internal static BoundStatement AddSequencePoint(PropertyDeclarationSyntax declarationSyntax, BoundStatement rewrittenStatement)
Parser\LanguageParser.cs (1)
5449return ((CSharp.Syntax.PropertyDeclarationSyntax)decl).Modifiers;
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (3)
235var t = (PropertyDeclarationSyntax)node; 451arrowExpr = ((PropertyDeclarationSyntax)node).ExpressionBody;
Symbols\Source\SourceMemberContainerSymbol.cs (4)
3229var propertyDecl = (PropertyDeclarationSyntax)m; 5869var propertySyntax = (PropertyDeclarationSyntax)m;
Symbols\Source\SourcePropertySymbol.cs (4)
20internal static SourcePropertySymbol Create(SourceMemberContainerTypeSymbol containingType, Binder bodyBinder, PropertyDeclarationSyntax syntax, BindingDiagnosticBag diagnostics) 162if (syntax is PropertyDeclarationSyntax { Initializer: { } initializer }) 183PropertyDeclarationSyntax p => p.ExpressionBody, 189=> syntax is PropertyDeclarationSyntax { Initializer: { } };
Symbols\Source\SourcePropertySymbolBase.cs (1)
243string interfacePropertyName = IsIndexer ? WellKnownMemberNames.Indexer : ((PropertyDeclarationSyntax)syntax).Identifier.ValueText;
Syntax\LookupPosition.cs (1)
49PropertyDeclarationSyntax property)
Syntax\PropertyDeclarationSyntax.cs (1)
25public PropertyDeclarationSyntax WithSemicolon(SyntaxToken semicolon)
Syntax\SyntaxExtensions.cs (1)
47arrowExpr = ((PropertyDeclarationSyntax)node).ExpressionBody;
Syntax\SyntaxFactory.cs (1)
2498public static PropertyDeclarationSyntax PropertyDeclaration(
Syntax\SyntaxFacts.cs (1)
179return ((PropertyDeclarationSyntax)parent).Type == node;
Syntax\SyntaxNormalizer.cs (7)
330=> node is AccessorListSyntax { Parent: PropertyDeclarationSyntax { Initializer: not null } }; 399if (currentTokenParent?.Parent is PropertyDeclarationSyntax property && IsSingleLineProperty(property) && 400nextToken.Parent is PropertyDeclarationSyntax nextProperty && IsSingleLineProperty(nextProperty)) 454else if (currentToken.Parent is PropertyDeclarationSyntax property) 464Debug.Assert(((PropertyDeclarationSyntax)currentToken.Parent).SemicolonToken == currentToken); 467nextToken.Parent is PropertyDeclarationSyntax nextProperty && 1467private static bool IsSingleLineProperty(PropertyDeclarationSyntax property)
Microsoft.CodeAnalysis.CSharp.Analyzers (2)
MetaAnalyzers\CSharpReportDiagnosticAnalyzer.cs (2)
46var propertyDecl = accessor.FirstAncestorOrSelf<PropertyDeclarationSyntax>();
Microsoft.CodeAnalysis.CSharp.CodeStyle (42)
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (2)
185reference.GetSyntax(cancellationToken) is PropertyDeclarationSyntax property && 198PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Identifier,
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (2)
38var propertyDeclaration = (PropertyDeclarationSyntax)context.Node;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
22PropertyDeclarationSyntax,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (17)
21UseExpressionBodyHelper<PropertyDeclarationSyntax> 38protected override BlockSyntax GetBody(PropertyDeclarationSyntax declaration) 41protected override ArrowExpressionClauseSyntax GetExpressionBody(PropertyDeclarationSyntax declaration) 44protected override SyntaxToken GetSemicolonToken(PropertyDeclarationSyntax declaration) 47protected override PropertyDeclarationSyntax WithSemicolonToken(PropertyDeclarationSyntax declaration, SyntaxToken token) 50protected override PropertyDeclarationSyntax WithExpressionBody(PropertyDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 53protected override PropertyDeclarationSyntax WithAccessorList(PropertyDeclarationSyntax declaration, AccessorListSyntax accessorListSyntax) 56protected override PropertyDeclarationSyntax WithBody(PropertyDeclarationSyntax declaration, BlockSyntax body) 66protected override PropertyDeclarationSyntax WithGenerateBody( 67SemanticModel semanticModel, PropertyDeclarationSyntax declaration, CancellationToken cancellation) 70protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, PropertyDeclarationSyntax declaration, CancellationToken cancellationToken) 74PropertyDeclarationSyntax declaration, 83protected override Location GetDiagnosticLocation(PropertyDeclarationSyntax declaration)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
151if (declaration is PropertyDeclarationSyntax { Initializer: not null })
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
109if (nodeToRemove is not VariableDeclaratorSyntax and not PropertyDeclarationSyntax) 114if (nodeToRemove is PropertyDeclarationSyntax property)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (3)
51return ((PropertyDeclarationSyntax)member).Identifier; 166return ((PropertyDeclarationSyntax)member).Type; 192PropertyDeclarationSyntax property => property.ExpressionBody,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
483public static IPropertySymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, PropertyDeclarationSyntax syntax, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
354case PropertyDeclarationSyntax property: 356node.IsFoundUnder((PropertyDeclarationSyntax p) => p.Initializer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
169var propertyDeclNode = node as PropertyDeclarationSyntax;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
161if (node is PropertyDeclarationSyntax { AccessorList: not null } propertyDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SelectedMembers\CSharpSelectedMembers.cs (1)
18PropertyDeclarationSyntax,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
53return ((PropertyDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (2)
52var node = TryGetAncestorForLocation<PropertyDeclarationSyntax>(root, position, out propertyDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
1306=> ((PropertyDeclarationSyntax)node).Initializer; 1315=> node?.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Initializer == node;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (2)
108or PropertyDeclarationSyntax 122if (GetEnclosingMember(endToken) is PropertyDeclarationSyntax propertyDeclaration &&
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (60)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
56.OfType<PropertyDeclarationSyntax>() 122var property = result.Declaration; 592var p = result.Declaration;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (3)
25PropertyDeclarationSyntax? Declaration, 36ImmutableArray<PropertyDeclarationSyntax> properties, 117PropertyDeclarationSyntax property,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
37=> node is SimpleNameSyntax or PropertyDeclarationSyntax or MemberBindingExpressionSyntax;
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
37var originalNode = token.GetAncestor<PropertyDeclarationSyntax>() ??
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
88if (node.Parent?.Parent is PropertyDeclarationSyntax oldAccessor)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
49if (node is not (PropertyDeclarationSyntax or VariableDeclaratorSyntax { Parent.Parent: FieldDeclarationSyntax }))
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (4)
151PropertyDeclarationSyntax property => 204if (syntax is PropertyDeclarationSyntax declaration) 239if (node.Parent?.Parent is PropertyDeclarationSyntax propertyDeclaration) 244if (node is PropertyDeclarationSyntax propertyDeclarationSyntax)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (2)
38using var _ = PooledHashSet<PropertyDeclarationSyntax>.GetInstance(out var seenPartialProperties); 51if (accessor.Parent?.Parent is PropertyDeclarationSyntax containingProperty &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (14)
37PropertyDeclarationSyntax, 44protected override PropertyDeclarationSyntax GetPropertyDeclaration(SyntaxNode node) 45=> (PropertyDeclarationSyntax)node; 62protected override PropertyDeclarationSyntax RewriteFieldReferencesInProperty( 63PropertyDeclarationSyntax property, 77return (PropertyDeclarationSyntax)rewriter.Visit(property); 86PropertyDeclarationSyntax propertyDeclaration, 114var updatedProperty = propertyDeclaration 140var finalProperty = updatedProperty 145static PropertyDeclarationSyntax MoveAttributes( 146PropertyDeclarationSyntax property, 188PropertyDeclarationSyntax propertyDeclaration, 225if (propertyDeclaration is PropertyDeclarationSyntax { AccessorList.Accessors: var accessors } && 234private static bool NeedsSetter(Compilation compilation, PropertyDeclarationSyntax propertyDeclaration, bool isWrittenOutsideOfConstructor)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
493else if (declaration is PropertyDeclarationSyntax propertyDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
820var propertyDeclaration = (PropertyDeclarationSyntax)syntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (4)
130return Compare((PropertyDeclarationSyntax)x, (PropertyDeclarationSyntax)y); 260private int Compare(PropertyDeclarationSyntax x, PropertyDeclarationSyntax y)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (5)
32var lastProperty = members.LastOrDefault(m => m is PropertyDeclarationSyntax); 111private static PropertyDeclarationSyntax GeneratePropertyDeclaration( 124var propertyDeclaration = PropertyDeclaration( 198private static PropertyDeclarationSyntax UseExpressionBodyIfDesired( 199CSharpCodeGenerationContextInfo info, PropertyDeclarationSyntax declaration, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (6)
13/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 30/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 48/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 54PropertyDeclarationSyntax property => property.WithExpressionBody(expressionBody),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
564PropertyDeclarationSyntax or IndexerDeclarationSyntax => AttributeTargets.Property,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
521targetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, kind) ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (2)
64var property = (PropertyDeclarationSyntax)propertyDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1221if (equalsValue?.Parent is PropertyDeclarationSyntax propertyDecl) 1233private IEnumerable<TypeInferenceInfo> InferTypeInPropertyDeclaration(PropertyDeclarationSyntax propertyDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (6)
60if (syntaxRef.GetSyntax(cancellationToken) is PropertyDeclarationSyntax propertyDeclaration) 66var newPropertyDeclaration = isThrowNotImplementedProperty ? RemoveThrowNotImplemented(propertyDeclaration) : propertyDeclaration; 266=> node is PropertyDeclarationSyntax propertyDeclaration ? RemoveThrowNotImplemented(propertyDeclaration) : node; 268public static PropertyDeclarationSyntax RemoveThrowNotImplemented(PropertyDeclarationSyntax propertyDeclaration) 272var result = propertyDeclaration
Microsoft.CodeAnalysis.CSharp.Features (142)
CodeLens\CSharpCodeLensMemberFinder.cs (1)
61public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node)
Completion\CompletionProviders\CompletionUtilities.cs (1)
229else if (propertyDeclaration is PropertyDeclarationSyntax { ExpressionBody.Expression: { } expression })
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
261result = IsLastTokenOfType<PropertyDeclarationSyntax>(
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
32?? token.GetAncestor<PropertyDeclarationSyntax>()
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (1)
52?? token.GetAncestor<PropertyDeclarationSyntax>()
Completion\KeywordRecommenders\FieldKeywordRecommender.cs (2)
48if (node is ArrowExpressionClauseSyntax { Parent: PropertyDeclarationSyntax }) 51if (node is AccessorDeclarationSyntax { Parent: AccessorListSyntax { Parent: PropertyDeclarationSyntax } })
Completion\KeywordRecommenders\GetKeywordRecommender.cs (1)
16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.GetKeyword) ||
Completion\KeywordRecommenders\InitKeywordRecommender.cs (1)
16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.InitKeyword) ||
Completion\KeywordRecommenders\InternalKeywordRecommender.cs (1)
25if (context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(context.Position) ||
Completion\KeywordRecommenders\MethodKeywordRecommender.cs (1)
26Parent: PropertyDeclarationSyntax
Completion\KeywordRecommenders\ParamKeywordRecommender.cs (1)
31if (token.GetAncestor<PropertyDeclarationSyntax>() != null ||
Completion\KeywordRecommenders\PrivateKeywordRecommender.cs (1)
26if (context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(context.Position) ||
Completion\KeywordRecommenders\ProtectedKeywordRecommender.cs (1)
24if (context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(context.Position) ||
Completion\KeywordRecommenders\SetKeywordRecommender.cs (1)
16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.SetKeyword) ||
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (9)
34: AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider<PropertyDeclarationSyntax, TypeDeclarationSyntax, CSharpCodeGenerationContextInfo> 50PropertyDeclarationSyntax property, 60PropertyDeclarationSyntax property, 128var propertyDeclaration = (PropertyDeclarationSyntax)property; 156protected override SyntaxNode GetInitializerValue(PropertyDeclarationSyntax property) 159protected override PropertyDeclarationSyntax GetPropertyWithoutInitializer(PropertyDeclarationSyntax property) 163Document document, PropertyDeclarationSyntax property, CancellationToken cancellationToken)
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (3)
228if (initializer.Parent is not PropertyDeclarationSyntax and not VariableDeclaratorSyntax { Parent: VariableDeclarationSyntax { Parent: FieldDeclarationSyntax } }) 276if (initializer.Parent is PropertyDeclarationSyntax propertyDeclaration) 335lastFieldOrProperty = currentTypeDeclaration.Members.LastIndexOf(m => m is PropertyDeclarationSyntax);
Copilot\CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs (1)
106operation.Syntax.Parent is not ArrowExpressionClauseSyntax { Parent: PropertyDeclarationSyntax })
EditAndContinue\BreakpointSpans.cs (2)
336var property = (PropertyDeclarationSyntax)node;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (12)
61/// <see cref="PropertyDeclarationSyntax"/> for property initializers and expression bodies. 113Debug.Assert(((PropertyDeclarationSyntax)current).Initializer != null); 237Debug.Assert(position == ((PropertyDeclarationSyntax)node).Initializer!.SpanStart); 616var propertyDeclaration = (PropertyDeclarationSyntax)node; 917if (declaration is PropertyDeclarationSyntax { Initializer: not null }) 1192var oldHasExpressionBody = oldNode is PropertyDeclarationSyntax { ExpressionBody: not null } or IndexerDeclarationSyntax { ExpressionBody: not null }; 1193var newHasExpressionBody = newNode is PropertyDeclarationSyntax { ExpressionBody: not null } or IndexerDeclarationSyntax { ExpressionBody: not null }; 1319if (node is PropertyDeclarationSyntax { ExpressionBody: not null } or IndexerDeclarationSyntax { ExpressionBody: not null }) 1697var propertyDeclaration = (PropertyDeclarationSyntax)node; 2069return SyntaxUtilities.HasBackingField((PropertyDeclarationSyntax)node) ? FeaturesResources.auto_property : FeaturesResources.property_;
EditAndContinue\DeclarationBody\PropertyOrIndexerWithExplicitBodyDeclarationBody.cs (1)
20=> (propertyOrIndexer is PropertyDeclarationSyntax property) ? property.ExpressionBody! : ((IndexerDeclarationSyntax)propertyOrIndexer).ExpressionBody!;
EditAndContinue\SyntaxComparer.cs (1)
1474return ((PropertyDeclarationSyntax)node).Identifier;
EditAndContinue\SyntaxUtilities.cs (5)
42PropertyDeclarationSyntax { Initializer: { } propertyInitializer } 119if (syntax is ExpressionSyntax { Parent.Parent: PropertyDeclarationSyntax }) 141if (declaration is PropertyDeclarationSyntax property) 175if (node is PropertyDeclarationSyntax propertyDecl) 191public static bool HasBackingField(PropertyDeclarationSyntax property)
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (1)
62if (property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) is not PropertyDeclarationSyntax propertyDeclaration)
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (3)
34=> node is PropertyDeclarationSyntax; 67var propertyDeclaration = (PropertyDeclarationSyntax)node;
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
163PropertyDeclarationSyntax member => (member, member.ExplicitInterfaceSpecifier, member.Identifier),
ImplementInterface\CSharpImplementImplicitlyCodeRefactoringProvider.cs (1)
55PropertyDeclarationSyntax member => member.WithExplicitInterfaceSpecifier(null),
InheritanceMargin\CSharpInheritanceMarginService.cs (1)
69PropertyDeclarationSyntax propertyDeclarationNode => propertyDeclarationNode.Identifier,
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (2)
121syntaxRef2.GetSyntax(cancellationToken) is PropertyDeclarationSyntax { Initializer: null }) 283if (member is PropertyDeclarationSyntax { Initializer.Value: var propertyInitializer } propertyDeclaration)
LineSeparators\CSharpLineSeparatorService.cs (1)
142=> IsBadAccessorList(node as PropertyDeclarationSyntax);
Organizing\Organizers\PropertyDeclarationOrganizer.cs (3)
17internal sealed class PropertyDeclarationOrganizer : AbstractSyntaxNodeOrganizer<PropertyDeclarationSyntax> 25protected override PropertyDeclarationSyntax Organize( 26PropertyDeclarationSyntax syntax,
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (3)
67var propertyDeclaration = ConvertMethodsToPropertyWorker( 115public static PropertyDeclarationSyntax ConvertMethodsToPropertyWorker( 132var property = PropertyDeclaration(
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (6)
33AbstractReplacePropertyWithMethodsService<IdentifierNameSyntax, ExpressionSyntax, NameMemberCrefSyntax, StatementSyntax, PropertyDeclarationSyntax> 44if (propertyDeclarationNode is not PropertyDeclarationSyntax propertyDeclaration) 63PropertyDeclarationSyntax propertyDeclaration, 106PropertyDeclarationSyntax propertyDeclaration, 169PropertyDeclarationSyntax propertyDeclaration, 236PropertyDeclarationSyntax propertyDeclaration,
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (6)
26internal abstract class AbstractCSharpAutoPropertySnippetProvider : AbstractPropertySnippetProvider<PropertyDeclarationSyntax> 42protected override async Task<PropertyDeclarationSyntax> GenerateSnippetSyntaxAsync(Document document, int position, CancellationToken cancellationToken) 75protected override int GetTargetCaretPosition(PropertyDeclarationSyntax propertyDeclaration, SourceText sourceText) 79Document document, PropertyDeclarationSyntax propertyDeclaration, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken) 90protected override PropertyDeclarationSyntax? FindAddedSnippetSyntaxNode(SyntaxNode root, int position) 93return node.GetAncestorOrThis<PropertyDeclarationSyntax>();
SolutionExplorer\CSharpSolutionExplorerSymbolTreeItemProvider.cs (2)
180case PropertyDeclarationSyntax propertyDeclaration: 312void AddPropertyDeclaration(PropertyDeclarationSyntax propertyDeclaration)
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (2)
185reference.GetSyntax(cancellationToken) is PropertyDeclarationSyntax property && 198PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Identifier,
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (2)
38var propertyDeclaration = (PropertyDeclarationSyntax)context.Node;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
22PropertyDeclarationSyntax,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (17)
21UseExpressionBodyHelper<PropertyDeclarationSyntax> 38protected override BlockSyntax GetBody(PropertyDeclarationSyntax declaration) 41protected override ArrowExpressionClauseSyntax GetExpressionBody(PropertyDeclarationSyntax declaration) 44protected override SyntaxToken GetSemicolonToken(PropertyDeclarationSyntax declaration) 47protected override PropertyDeclarationSyntax WithSemicolonToken(PropertyDeclarationSyntax declaration, SyntaxToken token) 50protected override PropertyDeclarationSyntax WithExpressionBody(PropertyDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 53protected override PropertyDeclarationSyntax WithAccessorList(PropertyDeclarationSyntax declaration, AccessorListSyntax accessorListSyntax) 56protected override PropertyDeclarationSyntax WithBody(PropertyDeclarationSyntax declaration, BlockSyntax body) 66protected override PropertyDeclarationSyntax WithGenerateBody( 67SemanticModel semanticModel, PropertyDeclarationSyntax declaration, CancellationToken cancellation) 70protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, PropertyDeclarationSyntax declaration, CancellationToken cancellationToken) 74PropertyDeclarationSyntax declaration, 83protected override Location GetDiagnosticLocation(PropertyDeclarationSyntax declaration)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
151if (declaration is PropertyDeclarationSyntax { Initializer: not null })
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
109if (nodeToRemove is not VariableDeclaratorSyntax and not PropertyDeclarationSyntax) 114if (nodeToRemove is PropertyDeclarationSyntax property)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
56.OfType<PropertyDeclarationSyntax>() 122var property = result.Declaration; 592var p = result.Declaration;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (3)
25PropertyDeclarationSyntax? Declaration, 36ImmutableArray<PropertyDeclarationSyntax> properties, 117PropertyDeclarationSyntax property,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
37=> node is SimpleNameSyntax or PropertyDeclarationSyntax or MemberBindingExpressionSyntax;
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
37var originalNode = token.GetAncestor<PropertyDeclarationSyntax>() ??
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
88if (node.Parent?.Parent is PropertyDeclarationSyntax oldAccessor)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
49if (node is not (PropertyDeclarationSyntax or VariableDeclaratorSyntax { Parent.Parent: FieldDeclarationSyntax }))
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (4)
151PropertyDeclarationSyntax property => 204if (syntax is PropertyDeclarationSyntax declaration) 239if (node.Parent?.Parent is PropertyDeclarationSyntax propertyDeclaration) 244if (node is PropertyDeclarationSyntax propertyDeclarationSyntax)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (2)
38using var _ = PooledHashSet<PropertyDeclarationSyntax>.GetInstance(out var seenPartialProperties); 51if (accessor.Parent?.Parent is PropertyDeclarationSyntax containingProperty &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (14)
37PropertyDeclarationSyntax, 44protected override PropertyDeclarationSyntax GetPropertyDeclaration(SyntaxNode node) 45=> (PropertyDeclarationSyntax)node; 62protected override PropertyDeclarationSyntax RewriteFieldReferencesInProperty( 63PropertyDeclarationSyntax property, 77return (PropertyDeclarationSyntax)rewriter.Visit(property); 86PropertyDeclarationSyntax propertyDeclaration, 114var updatedProperty = propertyDeclaration 140var finalProperty = updatedProperty 145static PropertyDeclarationSyntax MoveAttributes( 146PropertyDeclarationSyntax property, 188PropertyDeclarationSyntax propertyDeclaration, 225if (propertyDeclaration is PropertyDeclarationSyntax { AccessorList.Accessors: var accessors } && 234private static bool NeedsSetter(Compilation compilation, PropertyDeclarationSyntax propertyDeclaration, bool isWrittenOutsideOfConstructor)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
493else if (declaration is PropertyDeclarationSyntax propertyDeclaration)
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (3)
235var t = (PropertyDeclarationSyntax)node; 451arrowExpr = ((PropertyDeclarationSyntax)node).ExpressionBody;
Structure\CSharpBlockStructureProvider.cs (1)
45builder.Add<PropertyDeclarationSyntax, PropertyDeclarationStructureProvider>();
Structure\CSharpStructureHelpers.cs (1)
281PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Modifiers.FirstOrNull() ?? propertyDeclaration.Type.GetFirstToken(),
Structure\Providers\PropertyDeclarationStructureProvider.cs (2)
12internal sealed class PropertyDeclarationStructureProvider : AbstractSyntaxNodeStructureProvider<PropertyDeclarationSyntax> 16PropertyDeclarationSyntax propertyDeclaration,
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (8)
Microsoft.CodeQuality.Analyzers\QualityGuidelines\CSharpDoNotInitializeUnnecessarily.Fixer.cs (2)
44if (node.Parent is PropertyDeclarationSyntax prop) 47var newProp = prop.TrackNodes(node);
Microsoft.NetCore.Analyzers\InteropServices\CSharpDynamicInterfaceCastableImplementation.Fixer.cs (2)
122var propertyDeclaration = (PropertyDeclarationSyntax)declaration;
Microsoft.NetCore.Analyzers\Performance\CSharpUseSearchValues.cs (2)
51syntax is PropertyDeclarationSyntax propertyDeclaration && 67internal static ExpressionSyntax? TryGetPropertyGetterExpression(PropertyDeclarationSyntax propertyDeclaration)
Microsoft.NetCore.Analyzers\Performance\CSharpUseSearchValues.Fixer.cs (1)
54if (syntax is PropertyDeclarationSyntax propertyDeclaration)
Microsoft.NetCore.Analyzers\Runtime\CSharpDetectPreviewFeatureAnalyzer.cs (1)
121if (methodOrPropertyDefinition is PropertyDeclarationSyntax propertyDeclaration)
Microsoft.CodeAnalysis.CSharp.Workspaces (73)
Classification\ClassificationHelpers.cs (1)
230else if (token.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Identifier == token)
CodeGeneration\CSharpSyntaxGenerator.cs (19)
448PropertyDeclarationSyntax property => 634SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 661var prop = (PropertyDeclarationSyntax)declaration; 832var property = (PropertyDeclarationSyntax)member; 2052PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Identifier.ValueText, 2082PropertyDeclarationSyntax propertyDeclaration => ReplaceWithTrivia(declaration, propertyDeclaration.Identifier, id), 2118return ((PropertyDeclarationSyntax)declaration).Type; 2155SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2424var pd = (PropertyDeclarationSyntax)declaration; 2480var pd = (PropertyDeclarationSyntax)declaration; 2553var pd = (PropertyDeclarationSyntax)declaration; 2593var pd = (PropertyDeclarationSyntax)declaration; 2700SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).ExpressionBody == null,
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (4)
38PropertyDeclarationSyntax, 362var property = (PropertyDeclarationSyntax)node; 422case PropertyDeclarationSyntax property:
Recommendations\CSharpRecommendationServiceRunner.cs (2)
449Parent: PropertyDeclarationSyntax or 505else if (member is PropertyDeclarationSyntax { Initializer.Value: IdentifierNameSyntax { Identifier.ValueText: var propertyInitializerIdentifier } } &&
Rename\CSharpRenameRewriterLanguageService.cs (1)
271=> accessor?.Parent?.Parent is PropertyDeclarationSyntax property // 3 null checks in one: accessor -> accessor list -> property declaration
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (3)
51return ((PropertyDeclarationSyntax)member).Identifier; 166return ((PropertyDeclarationSyntax)member).Type; 192PropertyDeclarationSyntax property => property.ExpressionBody,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
483public static IPropertySymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, PropertyDeclarationSyntax syntax, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
354case PropertyDeclarationSyntax property: 356node.IsFoundUnder((PropertyDeclarationSyntax p) => p.Initializer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
169var propertyDeclNode = node as PropertyDeclarationSyntax;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
161if (node is PropertyDeclarationSyntax { AccessorList: not null } propertyDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SelectedMembers\CSharpSelectedMembers.cs (1)
18PropertyDeclarationSyntax,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
53return ((PropertyDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (2)
52var node = TryGetAncestorForLocation<PropertyDeclarationSyntax>(root, position, out propertyDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
1306=> ((PropertyDeclarationSyntax)node).Initializer; 1315=> node?.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Initializer == node;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (2)
108or PropertyDeclarationSyntax 122if (GetEnclosingMember(endToken) is PropertyDeclarationSyntax propertyDeclaration &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
820var propertyDeclaration = (PropertyDeclarationSyntax)syntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (4)
130return Compare((PropertyDeclarationSyntax)x, (PropertyDeclarationSyntax)y); 260private int Compare(PropertyDeclarationSyntax x, PropertyDeclarationSyntax y)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (5)
32var lastProperty = members.LastOrDefault(m => m is PropertyDeclarationSyntax); 111private static PropertyDeclarationSyntax GeneratePropertyDeclaration( 124var propertyDeclaration = PropertyDeclaration( 198private static PropertyDeclarationSyntax UseExpressionBodyIfDesired( 199CSharpCodeGenerationContextInfo info, PropertyDeclarationSyntax declaration, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (6)
13/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 30/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 48/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 54PropertyDeclarationSyntax property => property.WithExpressionBody(expressionBody),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
564PropertyDeclarationSyntax or IndexerDeclarationSyntax => AttributeTargets.Property,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
521targetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, kind) ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (2)
64var property = (PropertyDeclarationSyntax)propertyDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1221if (equalsValue?.Parent is PropertyDeclarationSyntax propertyDecl) 1233private IEnumerable<TypeInferenceInfo> InferTypeInPropertyDeclaration(PropertyDeclarationSyntax propertyDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (6)
60if (syntaxRef.GetSyntax(cancellationToken) is PropertyDeclarationSyntax propertyDeclaration) 66var newPropertyDeclaration = isThrowNotImplementedProperty ? RemoveThrowNotImplemented(propertyDeclaration) : propertyDeclaration; 266=> node is PropertyDeclarationSyntax propertyDeclaration ? RemoveThrowNotImplemented(propertyDeclaration) : node; 268public static PropertyDeclarationSyntax RemoveThrowNotImplemented(PropertyDeclarationSyntax propertyDeclaration) 272var result = propertyDeclaration
Microsoft.CodeAnalysis.Razor.Compiler (1)
Analyzers\ComponentParameterNullableWarningSuppressor.cs (1)
37if (node is PropertyDeclarationSyntax propertySyntax && propertySyntax.AttributeLists.Any())
Microsoft.DotNet.GenFacades (2)
NotSupportedAssemblyGenerator.cs (2)
133public override SyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node) 217private string GetPropertyDefinition(PropertyDeclarationSyntax node) => GetFullyQualifiedName((TypeDeclarationSyntax)node.Parent) + "." + node.Identifier.ValueText;
Microsoft.Extensions.Options.SourceGeneration (1)
ParserUtilities.cs (1)
37x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.BuildMetadata (1)
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.Logging (2)
Parsing\Parser.LogProperties.cs (1)
77PropertyDeclarationSyntax propertySyntax => propertySyntax.Identifier.Text, // a regular property
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.Logging.Unit.Tests (2)
ParserUtilitiesTests.cs (2)
19var propertyDeclaration = SyntaxFactory.PropertyDeclaration( 30var anotherPropertyDeclaration = SyntaxFactory.PropertyDeclaration(
Microsoft.Gen.MetadataExtractor (1)
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.Metrics (1)
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.MetricsReports (1)
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.ML.InternalCodeAnalyzer (1)
NameAnalyzer.cs (1)
122=> CheckPascal(((PropertyDeclarationSyntax)context.Node).Identifier, context);
Roslyn.Diagnostics.CSharp.Analyzers (48)
CSharpAvoidOptSuffixForNullableEnableCode.cs (2)
62var propertyDeclaration = (PropertyDeclarationSyntax)context.Node;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (3)
51return ((PropertyDeclarationSyntax)member).Identifier; 166return ((PropertyDeclarationSyntax)member).Type; 192PropertyDeclarationSyntax property => property.ExpressionBody,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
483public static IPropertySymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, PropertyDeclarationSyntax syntax, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
354case PropertyDeclarationSyntax property: 356node.IsFoundUnder((PropertyDeclarationSyntax p) => p.Initializer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
169var propertyDeclNode = node as PropertyDeclarationSyntax;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
161if (node is PropertyDeclarationSyntax { AccessorList: not null } propertyDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SelectedMembers\CSharpSelectedMembers.cs (1)
18PropertyDeclarationSyntax,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
53return ((PropertyDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (2)
52var node = TryGetAncestorForLocation<PropertyDeclarationSyntax>(root, position, out propertyDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
1306=> ((PropertyDeclarationSyntax)node).Initializer; 1315=> node?.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Initializer == node;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (2)
108or PropertyDeclarationSyntax 122if (GetEnclosingMember(endToken) is PropertyDeclarationSyntax propertyDeclaration &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
820var propertyDeclaration = (PropertyDeclarationSyntax)syntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (4)
130return Compare((PropertyDeclarationSyntax)x, (PropertyDeclarationSyntax)y); 260private int Compare(PropertyDeclarationSyntax x, PropertyDeclarationSyntax y)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (5)
32var lastProperty = members.LastOrDefault(m => m is PropertyDeclarationSyntax); 111private static PropertyDeclarationSyntax GeneratePropertyDeclaration( 124var propertyDeclaration = PropertyDeclaration( 198private static PropertyDeclarationSyntax UseExpressionBodyIfDesired( 199CSharpCodeGenerationContextInfo info, PropertyDeclarationSyntax declaration, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (6)
13/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 30/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 48/// Available if <paramref name="node"/> is <see cref="PropertyDeclarationSyntax"/> or <see cref="IndexerDeclarationSyntax"/>. 54PropertyDeclarationSyntax property => property.WithExpressionBody(expressionBody),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
564PropertyDeclarationSyntax or IndexerDeclarationSyntax => AttributeTargets.Property,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
521targetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, kind) ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (2)
64var property = (PropertyDeclarationSyntax)propertyDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1221if (equalsValue?.Parent is PropertyDeclarationSyntax propertyDecl) 1233private IEnumerable<TypeInferenceInfo> InferTypeInPropertyDeclaration(PropertyDeclarationSyntax propertyDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (6)
60if (syntaxRef.GetSyntax(cancellationToken) is PropertyDeclarationSyntax propertyDeclaration) 66var newPropertyDeclaration = isThrowNotImplementedProperty ? RemoveThrowNotImplemented(propertyDeclaration) : propertyDeclaration; 266=> node is PropertyDeclarationSyntax propertyDeclaration ? RemoveThrowNotImplemented(propertyDeclaration) : node; 268public static PropertyDeclarationSyntax RemoveThrowNotImplemented(PropertyDeclarationSyntax propertyDeclaration) 272var result = propertyDeclaration
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
293if (propertyDefiningSyntax is PropertyDeclarationSyntax propertyDeclaration
System.Text.RegularExpressions.Generator (5)
RegexGenerator.cs (1)
67(node, _) => node is MethodDeclarationSyntax or PropertyDeclarationSyntax or IndexerDeclarationSyntax or AccessorDeclarationSyntax,
UpgradeToGeneratedRegexCodeFixer.cs (4)
71else if (nodeToFix.Ancestors().FirstOrDefault(a => a is PropertyDeclarationSyntax) is PropertyDeclarationSyntax propertyDeclaration) 243Document document, SyntaxNode root, SyntaxNode nodeToFix, PropertyDeclarationSyntax propertyDeclaration, CancellationToken cancellationToken) 533a is FieldDeclarationSyntax or PropertyDeclarationSyntax))
System.Windows.Forms.Analyzers.CodeFixes.CSharp (4)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (4)
42PropertyDeclarationSyntax? propertyDeclaration = root.FindToken(diagnosticSpan.Start) 45.OfType<PropertyDeclarationSyntax>() 59PropertyDeclarationSyntax propertyDeclarationSyntax, 86PropertyDeclarationSyntax newProperty = propertyDeclarationSyntax.WithoutLeadingTrivia();