On Thu, 2003-10-30 at 10:41, Jonathan Gilbert wrote:
> At 09:46 AM 29/10/2003 -0800, Jackson Harper jackson-at-ximian.com
> |mono-list subscription| wrote:
> >On Wed, 2003-10-29 at 09:33, Chris Seaton wrote:
> >> How do I know what OS my program is running on at run time? PlatformID
> >> contains no entry for any systems apart from Windows.
> >
> >http://www.nullenvoid.com/mono/wiki/index.php/DeveloperFaq?PHPSESSID=e94bd3
> 73fcad70a585f9bf5bb57ba841
> 
> This URL does not work for me in Internet Explorer:

Strange, it works for me. Anyway I think this is what Jackson wanted you
to see:


How can I tell dynamically what platform my code is running on?

This is one possible approach, contributed by Aleksey Demakov
([EMAIL PROTECTED])

  Type enumType = typeof (PlatformID);
  if (Enum.IsDefined (enumType, "Unix"))
  {
    if (~Environment.OSVersion.Platform == (PlatformID) Enum.Parse (enumType, "Unix"))
      Console.WriteLine ("Platform: Mono on Unix");
    else
      Console.WriteLine ("Platform: Mono on Win32");
  } else
    Console.WriteLine ("Platform: .NET");

/Richard
-- 
Dept. of Informatics and Mathematics
University of Trollh�ttan/Uddevalla
P.O. Box 957, SE-461 29 Trollh�ttan
Sweden

_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to