Missing ICodeParser implementation

G

Guest

I'm trying to parse a CSharp code to a CodeCompileUnit with a ICodeParser interface of CSharpCodeProvide

But it seems to me, i can't get a ICodeParser interface
Looks like ICodeParser is not implemented in Framework

here is the code i'm using

//

StringBuilder sb = new StringBuilder()
TextWriter w = new StringWriter(sb)

CSharpCodeProvider csharp = new CSharpCodeProvider()

ICodeParser parser = csharp.CreateParser()
ICodeGenerator gen = csharp.CreateGenerator()

string sourceString = textBox1.Text
TextReader reader = new StringReader(sourceString)

CodeCompileUnit codeUnit = parser.Parse(reader)
// of course, this works fine
// CodeCompileUnit codeUnit = new CodeSnippetCompileUnit(textBox1.Text)

CodeGeneratorOptions o = new CodeGeneratorOptions()

gen.GenerateCodeFromCompileUnit
codeUnit
w
o)

textBox2.Text = sb.ToString()

//
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top