[Mono-devel-list] Platform identification

Aleksey Demakov avd at openlinksw.com
Fri Nov 21 06:29:35 EST 2003

Hi all,

With a recent update of Mono I've run into a problem with platform 
identification. My code relied upon PlatformID.Unix for this
puporse. Now PlatformID.Unix no longer exists so my code no longer
works. Actually my method of platform identification has always
been a kludge so I don't complain about it. But if I start using
another kludge that works now I'm not sure how much time it will
stay working. I don't want to deal with this problem over and over

So could we introduce an official method of platform identification
that will remain working and supported all the time?

I'd suggest to add somewhere, e.g. to System.Environment or some new
class two properties:

static String PlatformName {get;}  // Returns OS name in the
                                    // style of uname.
static String RuntimeName {get;}   // Returns "Mono".

I think the use of strings instead of enums is much more flexible
since there is no need to change the type definition every time
Mono is ported to another platform. The idea behind RuntimeName is
to convince other people like DotGnu or even ECMA to use this
approach as well.


More information about the Mono-devel-list mailing list