[Mono-list] Runtime Platform Conditional Magic

Fergus Henderson fjh@cs.mu.oz.au
Mon, 9 Feb 2004 18:38:22 +1100

On 08-Feb-2004, Samuel Kaufman <skaufman@elite.net> wrote:
> What would be the best way for an application to check if it's running
> in Windows or another OS with Mono?

The best way is not to check for a specific OS, since code which checks
for specific operating systems is inherently non-portable.
Instead, it is better to check for the presence of the specific feature(s)
that your code needs to worry about (e.g. for path name syntax
use System.IO.Path.DirectorySeparatorChar, etc.)

Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.