#StackBounty: #c# #.net #roslyn #insertion C# Roslyn API: Insert Instructions/Methods between each nodes members

Bounty: 100

I just got into a personal project and I would like to be able to use the Roslyn API to insert instructions / methods between class members (So methods / instructions)

I am currently able to retrieve the different child nodes like here: Namespace> Class> Fileds / M├ęthods

But I would like to know how I can insert code between fields / method and not replace cod.

(At the location of the red lines below for example)

Nodes

EDIT: After some more research i found that i can use InsertTokensBefore, InsertNodesBefore or InsertTriviaBefore but i don’t understand how parse my functions (actually in text/string format) to the needed parameters


Get this bounty!!!