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