How to get information about runtime .Net Core

2019-05-01 17:12发布

问题:

I have an app which works on Linux and Windows. I need to know where the app is working for use difference code. Thanks

回答1:

You are probably looking for System.Runtime.InteropServices.RuntimeInformation with the IsOsPlatform function to do runtime checks.

Have look at the video tutorial https://channel9.msdn.com/Series/aspnetmonsters/ASPNET-Monsters-Episode-46-Finding-Platform-Information of the ASP.NET Monsters.