10 February 2011 regions CI Team

imageAs you already know I´m an adversary of #regions in the source code. If you don´t use the resharper instead of the Visual Studio helpers you will get a "˜region tag around the interface implementations. But, of course, there is a way to turn this off...

Scenario:

I have a IFoo interface and I want to write a suitable implementation. Visual Studio already shows me, that some actions are possible:

    public interface IFoo
    {
        void Run();
        void Stop();
    }

    public class FooImplementation : IFoo
    {
		...
    }

image

If you click:

image

Cool... but you will be disappointed if you see that some #regions are in the code now:

view plaincopy to clipboardprint
public class FooImplementation : IFoo   
    {  
        #region IFoo Members   
  
        public void Run()   
        {   
            throw new NotImplementedException();   
        }   
  
        public void Stop()   
        {   
            throw new NotImplementedException();   
        }  
 
        #endregion   
    }  

public class FooImplementation : IFoo
    {
        #region IFoo Members

        public void Run()
        {
            throw new NotImplementedException();
        }

        public void Stop()
        {
            throw new NotImplementedException();
        }

        #endregion
    }

So, how to deactivate this:

Tools -> Option -> Text Editor -> C# -> Advanced:

image

Deactivate this Checkbox and then it works without "#region..." Smiley

Resharper it self´s won´t do this stuff but maybe sometimes you accidently click on the assistance of Visual Studio.