Seed.IO 2.0.1

dotnet add package Seed.IO --version 2.0.1
NuGet\Install-Package Seed.IO -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Seed.IO" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Seed.IO --version 2.0.1
#r "nuget: Seed.IO, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Seed.IO as a Cake Addin
#addin nuget:?package=Seed.IO&version=2.0.1

// Install Seed.IO as a Cake Tool
#tool nuget:?package=Seed.IO&version=2.0.1

Seed.IO

Helper Library that contains an array of useful classes and helpers for working with IO in C#.

File Paths

Strings are used as the go to type when working with file paths in code however they have a bunch of issues.

  • Which direction to the braces go?
  • Does this path end with a slash or not?
  • Is this argument support a relative path or does it requires absolute?
  • How do I get the parent directory.

AbsolutePath and RelativePath try to fix this issues for you. Below is some of the things they can do to help you make less mistakes when it comes to IO.

Concatenation

Combining paths is one of the best features, you can never get the slash direction working

AbsolutePath images = new AbsolutePath("C:\\");
images \= "Images";
images \= "Cats" \ "On Holidays";
WriteLine(images);

// output: C:\\Images\Cats\On Holidays

Both the path objects have overload the division operator to make concatenation brain dead simple. You can get the brace is the wrong direction if you never type them out.

Path Comparison

All paths are normalized behind the scenes making comparison consistent. Below we have two paths with diffent casing and different seperators.

AbsolutePath leftString = new AbsolutePath("C:\\data");
AbsolutePath rightString = new AbsolutePath("c://DATA");

WriteLine($"The two paths are equal {leftString == rightString}");

// output: true

Paths are also resolved so any '..' are removed.

AbsolutePath leftString = new AbsolutePath("C:\\data");
AbsolutePath rightString = new AbsolutePath("C:\\data\\images\\...");

WriteLine($"The two paths are equal {leftString == rightString}");

// output: true

Multi Platform

The direction of the seperators changes depending on your current platform

// Enter a relative path with mixed separators
RelativePath path = new RelativePath("./docs\dogs");
// On Windows
path.ToString(); // .\docs\dogs
// Unix
path.ToString(); // ./docs/dogs 

// Note: AbsolutePaths are based off their root. 

On Windows all paths are case insensitive but on linux systems they are case sensitive.

Getting Relative Paths

You can get relatives path simply with one function call.

AbsolutePath left = "C:\\data\\graphs\\graph.png";
AbsolutePath right = "C:\\data\\images\\";
RelativePath relative = left.GetRelative(right);
WriteLine(relative);

// output: ".\..\images"

If the paths don't share a common root and exception will be thrown. If you are not sure you can always use TryGetRelative instead.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 167 4/17/2023
2.0.0 148 4/14/2023
1.0.0 428 11/9/2020