Hello,

> 2. Lots of existing code don't care about the framework version. In that
> case it's easier to use code that will work on both versions, like:
> 
> using System;
> 
> class Program {
> 
>       static void Main ()
>       {
>               int p = (int) Environment.OSVersion.Platform;
>               if ((p == 4) || (p == 128)) {
>                       Console.WriteLine ("Running on Unix");
>               } else {
>                       Console.WriteLine ("NOT running on Unix");
>               }
>       }
> }
> 
> % mcs test2.cs
> % mono test2.exe
> Running on Unix
> 
> % gmcs test2.cs
> % mono test2.exe
> Running on Unix

This approach is strongly recommended, and its the one that we should be
using inside our class libraries to avoid people mimicing the use of the
NET_2_0 define which will not be there for them.

Miguel
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to