Namespace indentation in Visual Studio with C# -


visual studio indents code within namespace. can avoided when disabling indentation globally, not want. in other cases, indentation fine, don't fact code 1 level - makes ugly me.

namespace x {     public class     {} } 

i prefer this:

namespace x { public class {  } } 

in c++, there's nice workaround explained here:

namespace x {; // ; after opening brace makes visual studio not indent class below.  class {};  } 

but in c#, namespace cannot directly contain fields doesn't work.

how can visual studio stop indenting namespaces without disabling indentation globally?

update visual studio 2013 behavior c++ has changed

tools->options->c/c++->formatting->indentation: [ ] indent namespace contents  

enables preferred formatting, while {; trick doesn't work anymore. no change c# find.

  1. text editor → c# → tabs → indenting — set "block"
  2. text editor → c# → formatting → general — turn off every checkbox saying "automatically format..."

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -