Page 1 of 1

sugestion

Posted: Sun Jan 09, 2005 10:52 pm
by xml
in a previous post it was said

Code: Select all

                 public char this[long i]
                {
#if __WXMSW__
                        get { return wxString_CharAt(wxObject, (uint)i); }
#else
                        get {return System.Convert.ToChar(wxString_CharAtInt(wxObject, (uint)i)); }
#endif                       
                }
 
couldnt the #if __WXMSW__ be replaced with RunningOnWindows() where this function was

Code: Select all

bool RunningInWindows()
 {
   return (System.IO.Path.DirectorySeparatorChar == "\");
 } 
so the wx.net.dll assembly would be the same on windows and linux

Posted: Wed Jan 12, 2005 1:09 pm
by AHUser
return (System.IO.Path.DirectorySeparatorChar == "\");
That is not a really good code for a platform decission.

I would prefere something like this:

Code: Select all

bool RunningInWindows()
{
  return System.Environment.OSVersion.Platform < (System.PlatformID)127;
}
127 is PlatformID.Unix which is not defined in enum System.PlatformID.