'C# Variable value based on OS

I would like to ask if there is any possibility to declare variable based on OS.

For example I would like to change a variable dllName if I use mac to joinery_solver_pinvoke.dylib and if windows to .dll.

  internal class Unsafe
  {
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //Basic Method and Examples for PInvoke
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //private const string dllName = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "joinery_solver_pinvoke.dll" : "joinery_solver_pinvoke.dylib";
            private const string dllName = "joinery_solver_pinvoke.dll";
    
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source