Cross-platform file name handling in .NET Core

How to handle file name in System.IO classes in a cross-platform manner to make it work on Windows and Linux? For example, I write this code that works perfectly on Windows, however it doesn't cre...