Dotnet Core: How to Detect Operating System OS platform [.Net Core]

Determining OS platform in .NET Core: Here in this article will learn how to get the operating system details on which our .NET Core application is running.Theirs a requirement in my one application where I have to detect on which operating system my .NET Core application is running, .i.e Windows Operating System, OSX Operating System, Linux Operating System and based on OS platform have to do further logic.
By using Environment.OSVersion we can achieve same in .Net Framework. But in .NET CORE Environment.OSVersion is not working so I was like how to determine whether my .NET Core app is running on Mac or Windows?

Finally, with a little Google, I came to know about InteropServices.RuntimeInformation. Runtime.InteropServices: Provides APIs to query about runtime and OS