title: Class declared inside of another class in C#
body: <p>I am working on some legacy code and have come across something that I'm not sure of. We have a <code>class y</code> that is declared inside of another <code>class x</code>. <code>Class y</code> is only ever used inside of <code>class x</code> but my question is why wouldn't you create a separate class file and put <code>class y</code> in there instead of declaring it inside of <code>class x</code>? Isn't this violating OOP's or is it just a matter of style since it is only ever used inside of this class. I'm refactoring some of this code and my first reaction would be to separate <code>class y</code> out into it's own file.<br/></p>
  
  <pre><code>namespace Library
  {
     public class x
     {
        // methods, properties, local members of class x
  
        class y
        {
           // methods, properties, local members of class y
        }
     }
  }
  </code></pre>