allencoded allencoded - 9 months ago 123
C# Question

System.Environment.OSVersion .NET Core 5.0 Framework replacement?

doesn't seem to be a part of .net core 5.0 (dnxcore50).

I am trying to determine which OS a user is on so when they save a file to the filesystem I know rather to use '/' or '\'

What should I use instead?

lkg lkg
Answer Source

Don't do the detection yourself. Use System.IO.Path.DirectorySeparatorChar. Also, if you always use Path to manipulate paths then you should get formatting that you need. This also works with URLs.