[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

CodeDOM and CodeCompileUnit

Donnie Hale

9/27/2002 6:37:00 PM

(I'm not sure if this is the most appropriate newsgroup, but I didn't see a
"dotnet.codedom" one. :)

I'm using CodeDOM to generate C# code (and likely VB at some point). I've
got a couple of questions, mostly of the nitpicky variety:

1) If I add "using" statements to a namespace (CodeNamespace.Imports.Add),
they show up inside the namespace scope rather than the more typically
hand-coded situation where they're outside:

e.g.
namespace MyNamespace { using System; // rest of namespace }

vs.

using System;
namespace MyNamespace { // rest of namespace }

Is there a way to change that behavior such that the using statements show
up outside the namespace scope?

2) If I generate from a CodeCompileUnit
(ICodeGenerator.GenerateCodeFromCompileUnit), I get a header with the
<autogenerated> tags/comments at the top:

//--------------------------------------------------------------------------
----
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.3705.209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//--------------------------------------------------------------------------
----

It seems that CodeCompileUnit has no Comments collection, as CodeNamespace
does. And although the CodeNamespace.Comments collection is empty, I still
get that comment block. If I add a comment to the CodeNamespace.Comments
collection, it shows up below that "autogenerated" comment block.

Is there a way to either modify the contents of this comment block and/or
eliminate it altogether.

Many thanks,

Donnie