- We will create a .NET Core console application in Visual Studio 2017. Under Visual C# templates, select .NET Core and a Console App (.NET Core) project:
- When you created your console application, the code will look as follows:
using System; class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } }
- Modify your code to look as follows:
static void Main(string[] args) { Console.WriteLine("I can run on Windows, Linux and macOS"); GetSystemInfo(); Console.ReadLine(); } private static void GetSystemInfo() { var osInfo = System.Runtime.InteropServices.RuntimeInformation.OSDescription; Console.WriteLine($"Current ...