418 references to PropertyDeclarationSyntax
Microsoft.CodeAnalysis.CSharp (47)
Binder\Binder_Statements.cs (1)
3452PropertyDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedProperty,
Binder\BinderFactory.BinderFactoryVisitor.cs (3)
375public override Binder VisitPropertyDeclaration(PropertyDeclarationSyntax parent) 476var propertyDecl = (PropertyDeclarationSyntax)basePropertyDeclarationSyntax;
Compilation\CSharpSemanticModel.cs (1)
3017public 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)
640public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
301public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (7)
928var propertyDecl = (PropertyDeclarationSyntax)memberDecl; 1133var propertyDecl = (PropertyDeclarationSyntax)node.Parent; 1536public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1640var propertyDecl = (PropertyDeclarationSyntax)declaration;
CSharpDeclarationComputer.cs (3)
211var t = (PropertyDeclarationSyntax)node; 398arrowExpr = ((PropertyDeclarationSyntax)node).ExpressionBody;
CSharpExtensions.cs (1)
1404public 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)
109var declaration = (PropertyDeclarationSyntax)grandparent;
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (1)
28internal static BoundStatement AddSequencePoint(PropertyDeclarationSyntax declarationSyntax, BoundStatement rewrittenStatement)
Parser\LanguageParser.cs (1)
4807return ((CSharp.Syntax.PropertyDeclarationSyntax)decl).Modifiers;
Symbols\Source\SourceMemberContainerSymbol.cs (4)
2663var propertyDecl = (PropertyDeclarationSyntax)m; 4746var propertySyntax = (PropertyDeclarationSyntax)m;
Symbols\Source\SourcePropertySymbol.cs (4)
16internal static SourcePropertySymbol Create(SourceMemberContainerTypeSymbol containingType, Binder bodyBinder, PropertyDeclarationSyntax syntax, BindingDiagnosticBag diagnostics) 135if (syntax is PropertyDeclarationSyntax { Initializer: { } initializer }) 150PropertyDeclarationSyntax p => p.ExpressionBody, 156=> syntax is PropertyDeclarationSyntax { Initializer: { } };
Symbols\Source\SourcePropertySymbolBase.cs (1)
208string 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)
2438public static PropertyDeclarationSyntax PropertyDeclaration(
Syntax\SyntaxFacts.cs (1)
179return ((PropertyDeclarationSyntax)parent).Type == node;
Syntax\SyntaxNormalizer.cs (7)
314=> node is AccessorListSyntax { Parent: PropertyDeclarationSyntax { Initializer: not null } }; 383if (currentTokenParent?.Parent is PropertyDeclarationSyntax property && IsSingleLineProperty(property) && 384nextToken.Parent is PropertyDeclarationSyntax nextProperty && IsSingleLineProperty(nextProperty)) 438else if (currentToken.Parent is PropertyDeclarationSyntax property) 448Debug.Assert(((PropertyDeclarationSyntax)currentToken.Parent).SemicolonToken == currentToken); 451nextToken.Parent is PropertyDeclarationSyntax nextProperty && 1437private static bool IsSingleLineProperty(PropertyDeclarationSyntax property)
Microsoft.CodeAnalysis.CSharp.CodeStyle (33)
CSharpAccessibilityFacts.cs (1)
58return ((PropertyDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
CSharpHeaderFacts.cs (2)
40var node = TryGetAncestorForLocation<PropertyDeclarationSyntax>(root, position);
CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
102PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Identifier,
CSharpSelectedMembers.cs (1)
20PropertyDeclarationSyntax,
CSharpSyntaxFacts.cs (1)
1394=> node?.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Initializer == node;
CSharpUseAutoPropertyAnalyzer.cs (1)
24PropertyDeclarationSyntax,
FormattingRangeHelper.cs (2)
125PropertyDeclarationSyntax or 138if (GetEnclosingMember(endToken) is PropertyDeclarationSyntax propertyDeclaration &&
MemberDeclarationSyntaxExtensions.cs (3)
48return ((PropertyDeclarationSyntax)member).Identifier; 151return ((PropertyDeclarationSyntax)member).Type; 181PropertyDeclarationSyntax property => property.ExpressionBody,
SuppressFormattingRule.cs (2)
168var propertyDeclNode = node as PropertyDeclarationSyntax;
SyntaxNodeExtensions.cs (1)
427node.IsFoundUnder((PropertyDeclarationSyntax p) => p.Initializer);
UseExpressionBodyForPropertiesHelper.cs (17)
18UseExpressionBodyHelper<PropertyDeclarationSyntax> 35protected override BlockSyntax GetBody(PropertyDeclarationSyntax declaration) 38protected override ArrowExpressionClauseSyntax GetExpressionBody(PropertyDeclarationSyntax declaration) 41protected override SyntaxToken GetSemicolonToken(PropertyDeclarationSyntax declaration) 44protected override PropertyDeclarationSyntax WithSemicolonToken(PropertyDeclarationSyntax declaration, SyntaxToken token) 47protected override PropertyDeclarationSyntax WithExpressionBody(PropertyDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 50protected override PropertyDeclarationSyntax WithAccessorList(PropertyDeclarationSyntax declaration, AccessorListSyntax accessorListSyntax) 53protected override PropertyDeclarationSyntax WithBody(PropertyDeclarationSyntax declaration, BlockSyntax body) 63protected override PropertyDeclarationSyntax WithGenerateBody(SemanticModel semanticModel, PropertyDeclarationSyntax declaration) 66protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, PropertyDeclarationSyntax declaration) => true; 69PropertyDeclarationSyntax declaration, 77protected override Location GetDiagnosticLocation(PropertyDeclarationSyntax declaration)
WrappingFormattingRule.cs (1)
164if (node is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.AccessorList != null)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (33)
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"/>. 57case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithExpressionBody(expressionBody);
ConvertToRecordEngine.cs (3)
53.OfType<PropertyDeclarationSyntax>() 144var property = result.Declaration; 569var p = result.Declaration;
CSharpChangeToIEnumerableCodeFixProvider.cs (2)
94var oldAccessor = node.Parent?.Parent as PropertyDeclarationSyntax;
CSharpCodeGenerationService.cs (2)
800var propertyDeclaration = (PropertyDeclarationSyntax)syntaxNode;
CSharpDeclarationComparer.cs (4)
130return Compare((PropertyDeclarationSyntax)x, (PropertyDeclarationSyntax)y); 260private int Compare(PropertyDeclarationSyntax x, PropertyDeclarationSyntax y)
CSharpDeclareAsNullableCodeFixProvider.cs (4)
173PropertyDeclarationSyntax property => 224if (syntax is PropertyDeclarationSyntax declaration) 258if (node.Parent?.Parent is PropertyDeclarationSyntax propertyDeclaration) 263if (node is PropertyDeclarationSyntax propertyDeclarationSyntax)
CSharpMakeMemberRequiredCodeFixProvider.cs (1)
56if (node is not (PropertyDeclarationSyntax or VariableDeclaratorSyntax { Parent.Parent: FieldDeclarationSyntax }))
CSharpTypeInferenceService.TypeInferrer.cs (2)
1231if (equalsValue?.Parent is PropertyDeclarationSyntax propertyDecl) 1243private IEnumerable<TypeInferenceInfo> InferTypeInPropertyDeclaration(PropertyDeclarationSyntax propertyDeclaration)
HideBaseCodeFixProvider.cs (1)
42var originalNode = token.GetAncestor<PropertyDeclarationSyntax>() ??
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (1)
518targetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, kind) ||
PositionalParameterInfo.cs (3)
25PropertyDeclarationSyntax? Declaration, 36ImmutableArray<PropertyDeclarationSyntax> properties, 118PropertyDeclarationSyntax property,
PropertyGenerator.cs (4)
30var lastProperty = members.LastOrDefault(m => m is PropertyDeclarationSyntax); 119var propertyDeclaration = SyntaxFactory.PropertyDeclaration( 175private static PropertyDeclarationSyntax UseExpressionBodyIfDesired( 176CSharpCodeGenerationContextInfo info, PropertyDeclarationSyntax declaration)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (5)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (5)
566&& parentOfParent is PropertyDeclarationSyntax) 777PropertyDeclarationSyntax propertyDeclarationNode => ShouldRemoveBraceForPropertyDeclaration(propertyDeclarationNode, caretPosition), 803private static bool ShouldRemoveBraceForPropertyDeclaration(PropertyDeclarationSyntax propertyDeclarationNode, int caretPosition) 970PropertyDeclarationSyntax propertyDeclarationNode => ConvertPropertyDeclarationToFieldDeclaration(propertyDeclarationNode), 1003PropertyDeclarationSyntax propertyDeclarationNode)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (7)
Diagnostics\Suppression\SuppressionTests.cs (2)
1093var property = (PropertyDeclarationSyntax)context.Node;
RefactoringHelpers\RefactoringHelpersTests.cs (3)
961await TestMissingAsync<PropertyDeclarationSyntax>(testText); 1079await TestAsync<PropertyDeclarationSyntax>(testText); 1092await TestMissingAsync<PropertyDeclarationSyntax>(testText);
Structure\MetadataAsSource\PropertyDeclarationStructureTests.cs (1)
16public class PropertyDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<PropertyDeclarationSyntax>
Structure\PropertyDeclarationStructureTests.cs (1)
17public class PropertyDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<PropertyDeclarationSyntax>
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (3)
Diagnostics\GetDiagnosticsTests.cs (2)
931if (operationBlock.Syntax is PropertyDeclarationSyntax or IndexerDeclarationSyntax) 957PropertyDeclarationSyntax propertyDecl => propertyDecl.Identifier.GetLocation(),
FlowAnalysis\FlowTests.cs (1)
5841var declarations = tree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToImmutableArray();
Microsoft.CodeAnalysis.CSharp.Features (120)
CodeLens\CSharpCodeLensMemberFinder.cs (1)
65public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
205result = IsLastTokenOfType<PropertyDeclarationSyntax>(
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
38?? token.GetAncestor<PropertyDeclarationSyntax>()
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (1)
59?? token.GetAncestor<PropertyDeclarationSyntax>()
Completion\KeywordRecommenders\GetKeywordRecommender.cs (1)
21context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.GetKeyword) ||
Completion\KeywordRecommenders\InitKeywordRecommender.cs (1)
21context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.InitKeyword) ||
Completion\KeywordRecommenders\InternalKeywordRecommender.cs (1)
30if (context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(context.Position) ||
Completion\KeywordRecommenders\MethodKeywordRecommender.cs (1)
32if (token.GetAncestor<PropertyDeclarationSyntax>() != null ||
Completion\KeywordRecommenders\ParamKeywordRecommender.cs (1)
26if (token.GetAncestor<PropertyDeclarationSyntax>() != null ||
Completion\KeywordRecommenders\PrivateKeywordRecommender.cs (1)
31if (context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(context.Position) ||
Completion\KeywordRecommenders\ProtectedKeywordRecommender.cs (1)
29if (context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(context.Position) ||
Completion\KeywordRecommenders\SetKeywordRecommender.cs (1)
21context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.SetKeyword) ||
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (6)
27internal class CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider : AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider<PropertyDeclarationSyntax, TypeDeclarationSyntax, CSharpCodeGenerationContextInfo> 54var accessorListSyntax = ((PropertyDeclarationSyntax)property).AccessorList; 118var propertyDeclaration = (PropertyDeclarationSyntax)property; 146=> ((PropertyDeclarationSyntax)property).Initializer?.Value; 149=> ((PropertyDeclarationSyntax)property).WithInitializer(null);
ConvertToRecordEngine.cs (3)
53.OfType<PropertyDeclarationSyntax>() 144var property = result.Declaration; 569var p = result.Declaration;
CSharpChangeToIEnumerableCodeFixProvider.cs (2)
94var oldAccessor = node.Parent?.Parent as PropertyDeclarationSyntax;
CSharpDeclarationComputer.cs (3)
211var t = (PropertyDeclarationSyntax)node; 398arrowExpr = ((PropertyDeclarationSyntax)node).ExpressionBody;
CSharpDeclareAsNullableCodeFixProvider.cs (4)
173PropertyDeclarationSyntax property => 224if (syntax is PropertyDeclarationSyntax declaration) 258if (node.Parent?.Parent is PropertyDeclarationSyntax propertyDeclaration) 263if (node is PropertyDeclarationSyntax propertyDeclarationSyntax)
CSharpMakeMemberRequiredCodeFixProvider.cs (1)
56if (node is not (PropertyDeclarationSyntax or VariableDeclaratorSyntax { Parent.Parent: FieldDeclarationSyntax }))
CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
102PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Identifier,
CSharpUseAutoPropertyAnalyzer.cs (1)
24PropertyDeclarationSyntax,
EditAndContinue\BreakpointSpans.cs (2)
229var property = (PropertyDeclarationSyntax)node;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (19)
79/// <see cref="PropertyDeclarationSyntax"/> for property initializers and expression bodies. 105RoslynDebug.Assert(((PropertyDeclarationSyntax)current).Initializer != null); 264if (node is PropertyDeclarationSyntax { ExpressionBody: var propertyExpressionBody and not null }) 406Debug.Assert(position == ((PropertyDeclarationSyntax)node).Initializer!.SpanStart); 691newNode is PropertyDeclarationSyntax property) 879var propertyDeclaration = (PropertyDeclarationSyntax)node; 1160=> propertyOrIndexerDeclaration is PropertyDeclarationSyntax propertyDecl && 1191=> declaration is VariableDeclaratorSyntax { Initializer: not null } or PropertyDeclarationSyntax { Initializer: not null }; 1199declaration is PropertyDeclarationSyntax { Identifier.ValueText: var name }) 1221if (declaration is AccessorDeclarationSyntax { Parent: AccessorListSyntax { Parent: PropertyDeclarationSyntax property } list } && 1299if (oldNode is PropertyDeclarationSyntax { ExpressionBody: not null } or IndexerDeclarationSyntax { ExpressionBody: not null } || 1300newNode is PropertyDeclarationSyntax { ExpressionBody: not null } or IndexerDeclarationSyntax { ExpressionBody: not null }) 1312if (oldNode is PropertyDeclarationSyntax oldProperty && newNode is PropertyDeclarationSyntax newProperty && DiffersInReadOnlyModifier(oldProperty.Modifiers, newProperty.Modifiers) || 1389if (node is PropertyDeclarationSyntax { ExpressionBody: not null } or IndexerDeclarationSyntax { ExpressionBody: not null }) 1666var propertyDeclaration = (PropertyDeclarationSyntax)node; 2032return SyntaxUtilities.HasBackingField((PropertyDeclarationSyntax)node) ? FeaturesResources.auto_property : FeaturesResources.property_;
EditAndContinue\SyntaxComparer.cs (1)
1453return ((PropertyDeclarationSyntax)node).Identifier;
EditAndContinue\SyntaxUtilities.cs (6)
61var propertyDeclaration = (PropertyDeclarationSyntax)node; 115if (syntax is ExpressionSyntax && syntax.Parent.Parent is PropertyDeclarationSyntax) 197if (declaration is PropertyDeclarationSyntax property) 231if (node is PropertyDeclarationSyntax propertyDecl) 247public static bool HasBackingField(PropertyDeclarationSyntax property)
GenerateConstructorFromMembers\CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs (1)
66if (property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) is not PropertyDeclarationSyntax propertyDeclaration)
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (3)
32=> node is PropertyDeclarationSyntax; 65var propertyDeclaration = (PropertyDeclarationSyntax)node;
GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
45=> node is SimpleNameSyntax or PropertyDeclarationSyntax or MemberBindingExpressionSyntax;
HideBaseCodeFixProvider.cs (1)
42var originalNode = token.GetAncestor<PropertyDeclarationSyntax>() ??
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
160PropertyDeclarationSyntax member => (member, member.ExplicitInterfaceSpecifier, member.Identifier),
ImplementInterface\CSharpImplementImplicitlyCodeRefactoringProvider.cs (1)
59PropertyDeclarationSyntax member => member.WithExplicitInterfaceSpecifier(null),
InheritanceMargin\CSharpInheritanceMarginService.cs (1)
70PropertyDeclarationSyntax propertyDeclarationNode => propertyDeclarationNode.Identifier,
InitializeParameter\CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs (2)
73if (node is PropertyDeclarationSyntax propertyDeclaration) 77var result = propertyDeclaration
LineSeparators\CSharpLineSeparatorService.cs (1)
144=> IsBadAccessorList(node as PropertyDeclarationSyntax);
Organizing\Organizers\PropertyDeclarationOrganizer.cs (3)
17internal class PropertyDeclarationOrganizer : AbstractSyntaxNodeOrganizer<PropertyDeclarationSyntax> 25protected override PropertyDeclarationSyntax Organize( 26PropertyDeclarationSyntax syntax,
PositionalParameterInfo.cs (3)
25PropertyDeclarationSyntax? Declaration, 36ImmutableArray<PropertyDeclarationSyntax> properties, 118PropertyDeclarationSyntax property,
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (3)
64var propertyDeclaration = ConvertMethodsToPropertyWorker( 112public static PropertyDeclarationSyntax ConvertMethodsToPropertyWorker( 129var property = SyntaxFactory.PropertyDeclaration(
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (6)
28AbstractReplacePropertyWithMethodsService<IdentifierNameSyntax, ExpressionSyntax, NameMemberCrefSyntax, StatementSyntax, PropertyDeclarationSyntax> 46if (propertyDeclarationNode is not PropertyDeclarationSyntax propertyDeclaration) 65PropertyDeclarationSyntax propertyDeclaration, 106PropertyDeclarationSyntax propertyDeclaration, 164PropertyDeclarationSyntax propertyDeclaration, 227PropertyDeclarationSyntax propertyDeclaration,
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (5)
74var propertyDeclaration = (PropertyDeclarationSyntax)caretTarget; 81var propertyDeclaration = (PropertyDeclarationSyntax)node; 93return node.GetAncestorOrThis<PropertyDeclarationSyntax>();
Structure\CSharpBlockStructureProvider.cs (1)
44builder.Add<PropertyDeclarationSyntax, PropertyDeclarationStructureProvider>();
Structure\CSharpStructureHelpers.cs (1)
304PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Modifiers.FirstOrNull() ?? propertyDeclaration.Type.GetFirstToken(),
Structure\Providers\PropertyDeclarationStructureProvider.cs (2)
12internal class PropertyDeclarationStructureProvider : AbstractSyntaxNodeStructureProvider<PropertyDeclarationSyntax> 16PropertyDeclarationSyntax propertyDeclaration,
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (6)
25: AbstractUseAutoPropertyCodeFixProvider<TypeDeclarationSyntax, PropertyDeclarationSyntax, VariableDeclaratorSyntax, ConstructorDeclarationSyntax, ExpressionSyntax> 33protected override PropertyDeclarationSyntax GetPropertyDeclaration(SyntaxNode node) 34=> (PropertyDeclarationSyntax)node; 45PropertyDeclarationSyntax propertyDeclaration, bool isWrittenOutsideOfConstructor, CancellationToken cancellationToken) 50var updatedProperty = propertyDeclaration.WithAccessorList(UpdateAccessorList(propertyDeclaration.AccessorList)) 141private static bool NeedsSetter(Compilation compilation, PropertyDeclarationSyntax propertyDeclaration, bool isWrittenOutsideOfConstructor)
UseExpressionBodyForPropertiesHelper.cs (17)
18UseExpressionBodyHelper<PropertyDeclarationSyntax> 35protected override BlockSyntax GetBody(PropertyDeclarationSyntax declaration) 38protected override ArrowExpressionClauseSyntax GetExpressionBody(PropertyDeclarationSyntax declaration) 41protected override SyntaxToken GetSemicolonToken(PropertyDeclarationSyntax declaration) 44protected override PropertyDeclarationSyntax WithSemicolonToken(PropertyDeclarationSyntax declaration, SyntaxToken token) 47protected override PropertyDeclarationSyntax WithExpressionBody(PropertyDeclarationSyntax declaration, ArrowExpressionClauseSyntax expressionBody) 50protected override PropertyDeclarationSyntax WithAccessorList(PropertyDeclarationSyntax declaration, AccessorListSyntax accessorListSyntax) 53protected override PropertyDeclarationSyntax WithBody(PropertyDeclarationSyntax declaration, BlockSyntax body) 63protected override PropertyDeclarationSyntax WithGenerateBody(SemanticModel semanticModel, PropertyDeclarationSyntax declaration) 66protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, PropertyDeclarationSyntax declaration) => true; 69PropertyDeclarationSyntax declaration, 77protected override Location GetDiagnosticLocation(PropertyDeclarationSyntax declaration)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (1)
IOperation\IOperationTests_ISymbolInitializer.cs (1)
33var nodes = tree.GetRoot().DescendantNodes().Where(n => n is VariableDeclarationSyntax || n is PropertyDeclarationSyntax).ToArray();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\NullableContextTests.cs (2)
2048var declarations = syntaxTree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToArray(); 2057void verify(PropertyDeclarationSyntax syntax, string expectedText, Microsoft.CodeAnalysis.NullableFlowState expectedFlowState)
SourceGeneration\SyntaxAwareGeneratorTests.cs (1)
462TestSyntaxReceiver receiver1 = new TestSyntaxReceiver(tag: 0, callback: (a) => { if (a is PropertyDeclarationSyntax) throw new Exception("Test Exception"); });
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (12)
Compilation\SemanticModelAPITests.cs (4)
1628var propertyDecl = (PropertyDeclarationSyntax)typeDecl.Members[0]; 2486var propertyDecl = (PropertyDeclarationSyntax)typeDecl.Members[0];
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (8)
301var propertyDecl = (PropertyDeclarationSyntax)typeDecl.Members[0]; 521var node = (PropertyDeclarationSyntax)typeDecl.Members[0]; 2858var explicitPropertyNode = (PropertyDeclarationSyntax)classMemberNodes[1]; 3146var accessors = (synType.Members[0] as PropertyDeclarationSyntax).AccessorList; 3153accessors = (synType.Members[1] as PropertyDeclarationSyntax).AccessorList;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (49)
Generated\Syntax.Test.xml.Generated.cs (5)
10538private static PropertyDeclarationSyntax GeneratePropertyDeclaration() 13044var node = GeneratePropertyDeclaration(); 13055var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithType(node.Type).WithExplicitInterfaceSpecifier(node.ExplicitInterfaceSpecifier).WithIdentifier(node.Identifier).WithAccessorList(node.AccessorList).WithExpressionBody(node.ExpressionBody).WithInitializer(node.Initializer).WithSemicolonToken(node.SemicolonToken); 18533var oldNode = GeneratePropertyDeclaration(); 18549var oldNode = GeneratePropertyDeclaration();
IncrementalParsing\TypeChanges.cs (4)
93var propertyType = classType.Members[0] as PropertyDeclarationSyntax; 109var propertyType = classType.Members[0] as PropertyDeclarationSyntax;
LexicalAndXml\XmlDocCommentTests.cs (2)
1901Assert.Equal(typeof(PropertyDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1903var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as PropertyDeclarationSyntax).Type;
Parsing\DeclarationParsingTests.cs (24)
2906var propertySyntax = (PropertyDeclarationSyntax)structDecl.Members[0]; 2947var propertySyntax = (PropertyDeclarationSyntax)structDecl.Members[0]; 4130var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4184var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4239var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4312var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4366var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4420var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4464var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4504var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4616var ps = (PropertyDeclarationSyntax)cs.Members[0]; 4700var ps = (PropertyDeclarationSyntax)cs.Members[0];
Parsing\ParsingErrorRecoveryTests.cs (14)
5602var pd = (PropertyDeclarationSyntax)agg.Members[0]; 5627var pd = (PropertyDeclarationSyntax)agg.Members[0]; 5652var pd = (PropertyDeclarationSyntax)agg.Members[0]; 5687var pd = (PropertyDeclarationSyntax)agg.Members[0]; 5726var pd = (PropertyDeclarationSyntax)agg.Members[0]; 5762var propertyDecl = (PropertyDeclarationSyntax)classDecl.Members[0]; 5794var propertyDecl = (PropertyDeclarationSyntax)classDecl.Members[0];
Microsoft.CodeAnalysis.CSharp.Workspaces (57)
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"/>. 57case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithExpressionBody(expressionBody);
Classification\ClassificationHelpers.cs (1)
224else if (token.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Identifier == token)
CodeGeneration\CSharpSyntaxGenerator.cs (19)
420PropertyDeclarationSyntax property => property.WithAccessorList(CreateAccessorList(property.AccessorList, accessorDeclarations)) 609SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 636var prop = (PropertyDeclarationSyntax)declaration; 801var property = (PropertyDeclarationSyntax)member; 1892PropertyDeclarationSyntax propertyDeclaration => propertyDeclaration.Identifier.ValueText, 1922PropertyDeclarationSyntax propertyDeclaration => ReplaceWithTrivia(declaration, propertyDeclaration.Identifier, id), 1958return ((PropertyDeclarationSyntax)declaration).Type; 1995SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2267var pd = (PropertyDeclarationSyntax)declaration; 2323var pd = (PropertyDeclarationSyntax)declaration; 2396var pd = (PropertyDeclarationSyntax)declaration; 2436var pd = (PropertyDeclarationSyntax)declaration; 2566SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).ExpressionBody == null,
CSharpAccessibilityFacts.cs (1)
58return ((PropertyDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
CSharpCodeGenerationService.cs (2)
800var propertyDeclaration = (PropertyDeclarationSyntax)syntaxNode;
CSharpDeclarationComparer.cs (4)
130return Compare((PropertyDeclarationSyntax)x, (PropertyDeclarationSyntax)y); 260private int Compare(PropertyDeclarationSyntax x, PropertyDeclarationSyntax y)
CSharpHeaderFacts.cs (2)
40var node = TryGetAncestorForLocation<PropertyDeclarationSyntax>(root, position);
CSharpSelectedMembers.cs (1)
20PropertyDeclarationSyntax,
CSharpSyntaxFacts.cs (1)
1394=> node?.Parent is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.Initializer == node;
CSharpTypeInferenceService.TypeInferrer.cs (2)
1231if (equalsValue?.Parent is PropertyDeclarationSyntax propertyDecl) 1243private IEnumerable<TypeInferenceInfo> InferTypeInPropertyDeclaration(PropertyDeclarationSyntax propertyDeclaration)
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (3)
369var property = (PropertyDeclarationSyntax)node; 429case PropertyDeclarationSyntax property:
FormattingRangeHelper.cs (2)
125PropertyDeclarationSyntax or 138if (GetEnclosingMember(endToken) is PropertyDeclarationSyntax propertyDeclaration &&
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (1)
427node.IsFoundUnder((PropertyDeclarationSyntax p) => p.Initializer);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (1)
518targetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, kind) ||
MemberDeclarationSyntaxExtensions.cs (3)
48return ((PropertyDeclarationSyntax)member).Identifier; 151return ((PropertyDeclarationSyntax)member).Type; 181PropertyDeclarationSyntax property => property.ExpressionBody,
PropertyGenerator.cs (4)
30var lastProperty = members.LastOrDefault(m => m is PropertyDeclarationSyntax); 119var propertyDeclaration = SyntaxFactory.PropertyDeclaration( 175private static PropertyDeclarationSyntax UseExpressionBodyIfDesired( 176CSharpCodeGenerationContextInfo info, PropertyDeclarationSyntax declaration)
Rename\CSharpRenameRewriterLanguageService.cs (1)
277=> accessor?.Parent?.Parent is PropertyDeclarationSyntax property // 3 null checks in one: accessor -> accessor list -> property declaration
SuppressFormattingRule.cs (2)
168var propertyDeclNode = node as PropertyDeclarationSyntax;
WrappingFormattingRule.cs (1)
164if (node is PropertyDeclarationSyntax propertyDeclaration && propertyDeclaration.AccessorList != null)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (36)
CodeGeneration\SyntaxGeneratorTests.cs (34)
1020VerifySyntax<PropertyDeclarationSyntax>( 1024VerifySyntax<PropertyDeclarationSyntax>( 1028VerifySyntax<PropertyDeclarationSyntax>( 1032VerifySyntax<PropertyDeclarationSyntax>( 1036VerifySyntax<PropertyDeclarationSyntax>( 1040VerifySyntax<PropertyDeclarationSyntax>( 1044VerifySyntax<PropertyDeclarationSyntax>( 1048VerifySyntax<PropertyDeclarationSyntax>( 1052VerifySyntax<PropertyDeclarationSyntax>( 1056VerifySyntax<PropertyDeclarationSyntax>( 1060VerifySyntax<PropertyDeclarationSyntax>( 1064VerifySyntax<PropertyDeclarationSyntax>( 1162VerifySyntax<PropertyDeclarationSyntax>( 1331VerifySyntax<PropertyDeclarationSyntax>( 1351VerifySyntax<PropertyDeclarationSyntax>( 1478VerifySyntax<PropertyDeclarationSyntax>( 1868VerifySyntax<PropertyDeclarationSyntax>( 2335VerifySyntax<PropertyDeclarationSyntax>( 2353VerifySyntax<PropertyDeclarationSyntax>( 2507VerifySyntax<PropertyDeclarationSyntax>( 3064var property = (PropertyDeclarationSyntax)SyntaxFactory.ParseMemberDeclaration("public virtual int P { get; }"); 3066VerifySyntax<PropertyDeclarationSyntax>(updatedProperty, "public virtual required int P { get; }"); 3072var property = (PropertyDeclarationSyntax)SyntaxFactory.ParseMemberDeclaration("public required int P { get; }"); 3074VerifySyntax<PropertyDeclarationSyntax>(updatedProperty, "public virtual required int P { get; }"); 3082var property = (PropertyDeclarationSyntax)SyntaxFactory.ParseMemberDeclaration($$"""{{modifier}} int P { get; }"""); 3084VerifySyntax<PropertyDeclarationSyntax>(updatedProperty, $$"""{{modifier}} required int P { get; }"""); 3298VerifySyntax<PropertyDeclarationSyntax>( 3302VerifySyntax<PropertyDeclarationSyntax>( 3308VerifySyntax<PropertyDeclarationSyntax>( 3314VerifySyntax<PropertyDeclarationSyntax>( 4186VerifySyntax<PropertyDeclarationSyntax>(
Formatting\FormattingElasticTriviaTests.cs (1)
153var property = SyntaxFactory.PropertyDeclaration(
Formatting\FormattingTests.cs (1)
4507var property = SyntaxFactory.PropertyDeclaration(
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SymbolKeyTests.cs (1)
1022n => n is CSharp.Syntax.PropertyDeclarationSyntax).Single();
Microsoft.VisualStudio.LanguageServices.CSharp (11)
CodeModel\CSharpCodeModelService.cs (9)
821return ((PropertyDeclarationSyntax)node).ExplicitInterfaceSpecifier?.ToString() + 822((PropertyDeclarationSyntax)node).Identifier.ToString(); 901return ((PropertyDeclarationSyntax)node).WithIdentifier(newIdentifier); 1472=> (node as PropertyDeclarationSyntax)?.ExpressionBody != null; 1476accessorNode = (parentNode as PropertyDeclarationSyntax)?.ExpressionBody; 3415else if (container is PropertyDeclarationSyntax property) 3538private static bool IsAutoImplementedProperty(PropertyDeclarationSyntax propertyDeclaration) 3656var propertyDeclaration = (PropertyDeclarationSyntax)node;
CodeModel\CSharpCodeModelService.NodeNameGenerator.cs (2)
241var propertyDeclaration = (PropertyDeclarationSyntax)node;