c# - Controlling CodeModel's code output formatting: putting lines between namespace declarations -


I'm experimenting with Visual Studio's CodeModel. I tried to create a file with two namespaces via VS code model:

  CodeModel CodeModel = Project.ConfigurationProject CodeModel; CodeModel. Update Location ("Namespace First Namespace", "NamePackstest CCS"); CodeModel.Update Namespace ("Namespace.pdf Namespace", "NamePackstest CCS");  

The output of this type of code is:

  // file namepexest cs namespace namespace. First namespace {} namespace namespace. The other namespace {}  

Which About What I see is the only catch here is that I want to control the difference: first and second names Between at least one row Any chance anyone has a way to get it?

This is what I want to:

  // file namepixiestest Namespace namespace. First namespace {} namespace namespace. Other namespace {}  

thanks

statement codemodel .AddNamespace will give you an object named codenamed. You can find the EditPoint of the namespace using your first namespace and then enter a line like this.

  Your namespace = codemodel for codified names.adenetespace (....); EditPoint2 endEditPoint = yournamespace.GetEndPoint (vs. VsCMPartWhole) .CreateEditPoint (); EndEditPoint.InsertNewLine (1);  

I'm not sure that this will keep the line at your desired place, but it is the idea that get editpoint and then insert it into line.


Comments