[Mono-list] Unable to get environment variable

William Huskey william.huskey at gmail.com
Sat Mar 10 23:06:10 EST 2007


would this not work

using System;
using System.Collections.Generic;

namespace tryMe
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            OperatingSystem os = Environment.OSVersion;

            Console.WriteLine(os.VersionString);
            Console.WriteLine(os.Platform);
            Console.WriteLine(os.Version);
            Console.WriteLine(os.ToString());

            Console.WriteLine("\nPress any key to end");
            Console.ReadKey();
        }
    }
}
On 3/8/07, Jason Perkins <starkos at gmail.com> wrote:
>
> I'm new to non-MS platforms, so my apologies if this isn't a mono
> specific question.
>
> I've got mono running on my new OS X box. I am trying to add some code
> to my application to detect the platform. I thought it would be as
> easy as calling Environment.GetEnvironmentVariable("OSTYPE") and
> parsing the result, but the call always returns null, even though
> typing `echo $OSTYPE` at a shell prompt returns `darwin8.0`.
>
> Any idea what I'm doing wrong here? Many thanks!
>
> Jason
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>



-- 
William S. Huskey

UNIX Systems Engineer

Maritime Systems Solutions Division

SAIC

Tel: 425-267-5643

Email: huskeyw at saic.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070310/8cd0280e/attachment.html 


More information about the Mono-list mailing list