BitcoderCZ.IO 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package BitcoderCZ.IO --version 1.1.0
                    
NuGet\Install-Package BitcoderCZ.IO -Version 1.1.0
                    
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="BitcoderCZ.IO" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BitcoderCZ.IO" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="BitcoderCZ.IO" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BitcoderCZ.IO --version 1.1.0
                    
#r "nuget: BitcoderCZ.IO, 1.1.0"
                    
#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.
#:package BitcoderCZ.IO@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BitcoderCZ.IO&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=BitcoderCZ.IO&version=1.1.0
                    
Install as a Cake Tool

BitcoderCZ.IO

License: MIT NuGet Version

A strongly-typed C# library for safe path manipulation. It distinguishes between absolute and relative paths, as well as directories and files.

Key Features

  • Type Safety: Separate interfaces and classes for absolute vs. relative paths, and directories vs. files.
  • Easy Path Combination: Use the / operator to combine paths naturally.
  • Conversion Methods: Easy resolution of relative paths via .ToAbsolute() or computing differences via .RelativeTo().

Usage Examples

Combining Paths with /

You can use the / operator to construct paths dynamically.

  • Combining a directory with another directory or a string returns a directory.
  • Combining a directory with a file returns a file.
using BitcoderCZ.IO;

// Create a relative path structure
var root = new RelativeDirectory("abc");

// Combining with strings or other RelativeDirectories returns a RelativeDirectory
var subDir = root / "dir1" / "dir2"; 

// Combining with a RelativeFile returns a RelativeFile
var file = subDir / new RelativeFile("file.txt");
// path is now "abc/dir1/dir2/file.txt"

Absolute and Relative Paths

// Define an absolute base directory
var baseDir = new AbsoluteDirectory("/var/log");

// Combine absolute directory with relative path elements
var logFile = baseDir / "app" / new RelativeFile("error.log");
// path is "/var/log/app/error.log"

// Convert relative path to absolute
var relFile = new RelativeFile("settings.json");
var absFile = relFile.ToAbsolute(baseDir); // "/var/log/settings.json"

// Make an absolute path relative to another
var relDir = new AbsoluteDirectory("/var/log/app/data").RelativeTo(baseDir); // "app/data"

Directory and File Operations

The classes implement IDirectory and IFile respectively, providing common operations directly on the objects:

var appDir = new AbsoluteDirectory("/app/data");

if (!appDir.Exists)
{
    appDir.Create();
}

// Enumerate files or subdirectories
foreach (var file in appDir.EnumerateFiles(SearchOption.TopDirectoryOnly))
{
    Console.WriteLine($"{file.Name}: {file.Length} bytes");
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.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
1.2.0 52 8/10/2026
1.1.0 54 8/9/2026
1.0.0 50 8/7/2026