Last active
          August 29, 2015 14:00 
        
      - 
      
- 
        Save sandcastle/096f89b013587fa53b28 to your computer and use it in GitHub Desktop. 
    Platform check for Mono and Windows
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /// <summary> | |
| /// Helper methods for determining the platform. | |
| /// </summary> | |
| public static class Platform | |
| { | |
| /// <summary> | |
| /// Gets if the platform is Windows NT or later. | |
| /// </summary> | |
| public static bool IsWindows | |
| { | |
| get | |
| { | |
| return (Environment.OSVersion.Platform == PlatformID.Win32NT); | |
| } | |
| } | |
| /// <summary> | |
| /// Gets if the platform is Mono on Unix or Mac. | |
| /// </summary> | |
| public static bool IsMono | |
| { | |
| get | |
| { | |
| var platform = (int)Environment.OSVersion.Platform; | |
| return (platform == 4 /* Unix */ || platform == 6 /* MacOSX */ || platform == 128 /* Legacy */); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment