tags:

views:

33

answers:

1

Hi Hthere,

is there a possibiliy to to edit c# code (in a file) via a parser or something? I want to add a new property /method/ interface to the class automatically. Does something already exist?

thanks, el

+1  A: 

There is a C# grammar for the Gold Parser (and .NET engines to process the tables), so that you may find what you need there.

Lucero
thanks for your awnser but i guess this is an overkill for my needs
elCapitano
Well, if the pattern where you want to insert it is known in advance, a Regex-based solution may be your friend. But that is not a parser, and it does not "understand" the code it is changing, in contrast to a real parser which finally creates an AST and lets you perform consitent analysis and changes (and in the end output the final code again via CodeDom or whatever).
Lucero