title: C# - Overriding somes classes available  in System namespace
body: <p>I've a project that need to be compiled in Compact .NET Framework 3.5 and .NET Framework 3.5 (2 projects in fact, just compiling options that changes between both).</p>
  
  <p>Problem is, some classes are missing in the CF .NET so I created it manually (and implemented all members of the class available in .NET</p>
  
  <p>One example : The FtpWebRequest / FtpWebResponse classes.</p>
  
  <p>It's bad to write something like this (if yes, why?) :</p>
  
  <pre><code>#if CFNET35 // Only if we are in Compact Framework 3.5 mode
  namespace System.Net
  {
      public class FtpWebRequest : WebRequest
      {
          // ...
      }
  
      public class FtpWebResponse : WebResponse
      {
          // ...
      }
  }
  #endif
  </code></pre>
  
  <p>I'm sure that in CF.NET35 these methods will never be available, so can I write it?</p>
  
  <p>I would write that in order to avoid a name collision when using the my library in projects.</p>
  
  <p>It allows me in other projects always <code>using System.Net;</code> whitout asking me which framework I use...</p>
  
  <p>Thanks !</p>
  
  <hr>
  
  <h2>EDIT</h2>
  
  <p>Few months later, I'd to assess the strategy I used.</p>
  
  <p>As said, I override System(.Net) namespace by doing conditional compilation, so I've two DLL's (one for CF.NET, one for .NET)</p>
  
  <p>That includes too that all my applications using this DLL are in double (each a time a CF.NET app and one .NET app that includes the corresponding library).</p>
  
  <p>So, was a bad idea, I've a lot of project in double and that's unnecessary in the way that a .NET app can directly include and use a CF.NET library.</p>
  
  <p>Moreover, something I haven't take care in consideration is if that a .NET app include a CF.NET library with an overriden System namespace, initialization of it will fail because of a class name collision...</p>
  
  <p>So, <strong>EPIC FAIL</strong>, providing a generic interface is the best way to manage this case.</p>