C# interface and implementation in the same file - good idea?
<p>I recently seen some C# code where the interface declaration and implementation where in the same file, like this</p>

<pre><code>namespace MyNameSpace.Foo
{
    public interface IFoo{
        void DoThis();
    }
    public class Foo : IFoo {
        public void DoThis();
    }
}
</code></pre>

<p>At first glance it seems all wrong to have declaration and implementation in the same file, but there are practical benefits. e.g. When you Go To Definition in Visual Studio the interface and implementation are there in the same file.  This approach does not prohibit you from having other implementations of the interface, such as may be needed for unit testing.  For interfaces that will only one implementation I think this can be a pragmatic approach.</p>

<p>Good or bad idea?</p>

<p>Extending the question:<br>
How do people use Visual Studio to navigate to an implementation when you have an interface reference <code>IFoo myFoo = FooFactory.getFoo(MY_FOO);</code> If I right click on IFoo and select Go To Definition I can get the interface declaration. Is there a way for me to get the list of implementations of IFoo as that's what I'm really interested in getting to.</p>
