admin管理员组

文章数量:1289911

I use OperatingSystem.IsWindows() method. However, I'm not sure about the behavior when the application is running on a virtual machine. Does it use virtual machine's operating system, or PC's operating system?

I use OperatingSystem.IsWindows() method. However, I'm not sure about the behavior when the application is running on a virtual machine. Does it use virtual machine's operating system, or PC's operating system?

Share Improve this question asked Feb 20 at 11:21 MuratMurat 1186 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 4

It actually doesn't even check anything at runtime. It just returns true or false depending on the target of the .NET CLR that the application is using.

From the source code:

[NonVersionable]
public static bool IsWindows() =>
    #if TARGET_WINDOWS
        true;
    #else
        false;
    #endif
 

本文标签: cNET OperatingSystem class behavior in virtual machineStack Overflow