Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add getter and setter to PropertyDeclarationSyntax?

Tags:

c#

roslyn

I'm creating a tool which can create properties through Roslyn. I would like to add getter and setters to a PropertyDeclarationSyntax.

How can I do this?

like image 333
Christo S. Christov Avatar asked Mar 14 '23 01:03

Christo S. Christov


1 Answers

You need to add an AccessorList, with accessors. Check out this online tool for the exact syntax tree creation: Roslyn Quoter.

like image 196
Tamas Avatar answered Apr 01 '23 00:04

Tamas