.net core determine the operating system

using System;
using System.Runtime.InteropServices; //Introduced from NuGet

namespace Core.Test
{
    class Program
    {
        static void Main(string[] args)
        {
                         Console.WriteLine("Determine whether it is Windows Linux OSX");
            Console.WriteLine($"Linux:{RuntimeInformation.IsOSPlatform(OSPlatform.Linux)}");
            Console.WriteLine($"OSX:{RuntimeInformation.IsOSPlatform(OSPlatform.OSX)}");
            Console.WriteLine($"Windows:{RuntimeInformation.IsOSPlatform(OSPlatform.Windows)}");

            Console.Read();
        }
    }
}

Intelligent Recommendation

Operating system core and driver

1. Operating system and core Operating System (OS) is actually a set of programs. The focus of this set of programs is to manage all the activities of the computer and drive all the hardware in the sy...

Linux and .Net Core (3) .NET Core operating environment installation

Install environment dependent packages Enter the command yum install libunwind libicu 2. Download the .NET SDK Enter the command sudo rpm -Uvhhttps://packages.microsoft.com/config/rhel/7/packages-micr...

Determine the appropriate operating system for the computer

1. Determine the number of CPU bits (of course 64 bits support 32 bits, otherwise it is not) Can be judged by using the CPU-Z tool The EM64T in the instruction set is a 64-bit CPU. The intel cpu shoul...

cmake determine the operating system platform

camke OS platform is determined in two ways: 1. 2.  ...

More Recommendation

Determine which operating system an IP is

Determine what operating system the target IP host is based on the TTL value: LINUX 64 Windows 2000/NT 128 Windows series32 UNIX series255 ping [IP address]; As shown: TTL=64 The operating system is L...

C# to determine the operating system type

C# to determine the operating system type //Get system information System.OperatingSystem osInfo = System.Environment.OSVersion; //Get operating system ID System.PlatformID platformID = osInfo.Platfor...

Spring's Condition to determine the operating system

Spring's Condition to determine the operating system Spring's Condition judgment operating system (part of the code) class annotation test Spring's Condition judgment operating system (part of the cod...

.net Core object?.Attributes then use if to determine

Before I saw someone else’s code, there is, for example, the following code. The focus is on the question mark in the if statement. This question mark probably means easier to understand, that i...

.net core Json sets the background to determine the case

The problem comes from I wrote an interface. The return type of the interface is JsonResult, but after docking, the first letter of the returned result is lowercase. Later, I checked the written data ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top