From the course: Eleven Tips for the .NET Developer
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Build Linux and Windows path strings - .NET Tutorial
From the course: Eleven Tips for the .NET Developer
Build Linux and Windows path strings
- [Narrator] One of the nice things about .NET Core is that you can create an application that'll run on multiple operating systems. So what I want to look at today is how do you get file path information in your application if you're running on Linux or Windows. So let's start by taking a look at Windows Terminal, which I have a open here. I'm in PowerShell. I'm going to be testing on Linux. I'm using Windows Subsystem for Linux. So if you don't have that installed, all you need to do is go to your PowerShell prompt and type in WSL--install. If you run this, Ubuntu is the default and then it'll install it and then I believe you have to restart Windows and you can start testing it. So once you've done that, then you'll have another prompt available here. So let's open that one. Okay, so I have navigated to a published folder over here and I'll navigate to the same folder in Linux. So we'll move up a couple directories and then we'll go to, (keyboard clicking) and then list the files…
Contents
-
-
-
(Locked)
Single file deployment: Self-contained application distribution4m 31s
-
(Locked)
Flatten sequence with LINQ SelectMany1m 52s
-
(Locked)
Extend the DateOnly type with extension methods4m 1s
-
(Locked)
Humanizer: Transform data into human-friendly text5m 5s
-
(Locked)
Return read-only collection with AsReadOnly method2m 18s
-
(Locked)
Build Linux and Windows path strings4m 19s
-
(Locked)
Create fake test data with the Bogus package7m 18s
-
(Locked)
Make a version endpoint for a web API3m 54s
-
(Locked)
Count unicode characters correctly in String3m 38s
-
(Locked)
Determine shared key values with the LINQ ToLookup method4m 53s
-
(Locked)
Create a Zip archive file2m 48s
-
(Locked)
-