I'm trying to figure out if a property is an auto property i.e.
public int Foo { get; set; }
Stared for a while at PropertyDeclarationSyntax
and IPropertySymbol
but did not find anything.
Guess an alternative is an extension method that evaluates if get
& set
does not contain any statements is one way but it does not feel very elegant.
Check whether any of the AccessorDeclarationSyntax
es in the PropertyDeclarationSyntax
's AccessorList
have a non-null Body
.
You can see this by looking at any property declaration using the Syntax Visualizer (from the Roslyn SDK extension).