SyntaxGenerator.PropertyDeclaration Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
PropertyDeclaration(IPropertySymbol, IEnumerable<SyntaxNode>, IEnumerable<SyntaxNode>) |
Creates a property declaration using an existing property symbol as a signature. |
PropertyDeclaration(String, SyntaxNode, Accessibility, DeclarationModifiers, IEnumerable<SyntaxNode>, IEnumerable<SyntaxNode>) |
Creates a property declaration. The property will have a |
PropertyDeclaration(IPropertySymbol, IEnumerable<SyntaxNode>, IEnumerable<SyntaxNode>)
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
Creates a property declaration using an existing property symbol as a signature.
public Microsoft.CodeAnalysis.SyntaxNode PropertyDeclaration (Microsoft.CodeAnalysis.IPropertySymbol property, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = default);
public Microsoft.CodeAnalysis.SyntaxNode PropertyDeclaration (Microsoft.CodeAnalysis.IPropertySymbol property, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode>? getAccessorStatements = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode>? setAccessorStatements = default);
member this.PropertyDeclaration : Microsoft.CodeAnalysis.IPropertySymbol * seq<Microsoft.CodeAnalysis.SyntaxNode> * seq<Microsoft.CodeAnalysis.SyntaxNode> -> Microsoft.CodeAnalysis.SyntaxNode
Public Function PropertyDeclaration (property As IPropertySymbol, Optional getAccessorStatements As IEnumerable(Of SyntaxNode) = Nothing, Optional setAccessorStatements As IEnumerable(Of SyntaxNode) = Nothing) As SyntaxNode
Parameters
- property
- IPropertySymbol
- getAccessorStatements
- IEnumerable<SyntaxNode>
- setAccessorStatements
- IEnumerable<SyntaxNode>
Returns
Applies to
PropertyDeclaration(String, SyntaxNode, Accessibility, DeclarationModifiers, IEnumerable<SyntaxNode>, IEnumerable<SyntaxNode>)
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
- Source:
- SyntaxGenerator.cs
Creates a property declaration. The property will have a get
accessor if
IsWriteOnly is false
and will have
a set
accessor if IsReadOnly is false
.
public abstract Microsoft.CodeAnalysis.SyntaxNode PropertyDeclaration (string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> getAccessorStatements = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> setAccessorStatements = default);
public abstract Microsoft.CodeAnalysis.SyntaxNode PropertyDeclaration (string name, Microsoft.CodeAnalysis.SyntaxNode type, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode>? getAccessorStatements = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode>? setAccessorStatements = default);
abstract member PropertyDeclaration : string * Microsoft.CodeAnalysis.SyntaxNode * Microsoft.CodeAnalysis.Accessibility * Microsoft.CodeAnalysis.Editing.DeclarationModifiers * seq<Microsoft.CodeAnalysis.SyntaxNode> * seq<Microsoft.CodeAnalysis.SyntaxNode> -> Microsoft.CodeAnalysis.SyntaxNode
Public MustOverride Function PropertyDeclaration (name As String, type As SyntaxNode, Optional accessibility As Accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Optional modifiers As DeclarationModifiers = Nothing, Optional getAccessorStatements As IEnumerable(Of SyntaxNode) = Nothing, Optional setAccessorStatements As IEnumerable(Of SyntaxNode) = Nothing) As SyntaxNode
Parameters
- name
- String
- type
- SyntaxNode
- accessibility
- Accessibility
- modifiers
- DeclarationModifiers
- getAccessorStatements
- IEnumerable<SyntaxNode>
- setAccessorStatements
- IEnumerable<SyntaxNode>
Returns
Remarks
In C# there is a distinction between passing in null
for getAccessorStatements
or setAccessorStatements
versus passing in an empty list. null
will produce an auto-property-accessor (i.e. get;
) whereas an empty list will produce an accessor with an empty block (i.e. get { }
).