CODEDOM - LINE

  • Thread starter Thread starter João Santa Bárbara
  • Start date Start date
J

João Santa Bárbara

Hi all
i have a CodeStatementCollection, and i want to see what's in each line
ex:
dim x as object = new XXXobject
x.myproperty=100

and so one ..

can someone help me ???
thks
JSB
 
I'm not sure to understand your need.
Do you want the VB.NET code for your CodeStatementCollection ?
In this case, you must iterate on each statement and call
"ICodeGenerator.GenerateCodeFromStatement".
Something like this:

ICodeGenerator VBCodeProvider cscProvider = new VBCodeProvider();
generator = cscProvider.CreateGenerator(myStreamWriter);
CodeGeneratorOptions cop = new CodeGeneratorOptions();

foreach (stmt in myCodeStatementCollection )
generator.GenerateCodeFromStatement(stmt, myStreamWriter, cop);

You need a StreamWriter to do that.

Lionel.
 
you can deduce from the type of CodeStatement and its Left and Right side
objects or if you want, you can try to browse for the code for the
CodeGenerator classes of .NET
 
Back
Top