I have a project that needs to be compiled in Compact.NET Framework 3.5 and .NET Framework 3.5 (actually 2 projects, just compiling the parameters that change between them). A.
The problem is that some classes are missing in CF.NET, so I created it manually (and implemented all the class members available in .NET
One example: FtpWebRequest / FtpWebResponse classes.
It's nice to write something like this (if so, why?):
#if CFNET35 // Only if we are in Compact Framework 3.5 mode namespace System.Net { public class FtpWebRequest : WebRequest { // ... } public class FtpWebResponse : WebResponse { // ... } }
I am sure that in CF.NET35 these methods will never be available, so can I write it?
I would write that to avoid name collisions when using my library in projects.
This allows me in other projects to always use using System.Net; don't ask me what infrastructure I use ...
Thanks!
EDIT
A few months later I had to evaluate the strategy that I used.
As I said, I redefine the System (.Net) namespace by performing conditional compilation, so I have two DLLs (one for CF.NET, one for .NET).
It also means that all my applications using this DLL are doubled (each time a CF.NET application and one .NET application that includes the corresponding library).
So, it was a bad idea, I have many projects twice, and this is superfluous in that the .NET application can directly include and use the CF.NET library.
Also, something that I didn't care about was that the .NET application included a CF.NET library with a redundant System namespace, which initialization would fail due to a class name collision ...
So EPIC FAIL , providing a common interface is the best way to manage this case.