TestableIO.System.IO.Abstractions.Extensions
22.0.4
Prefix Reserved
dotnet add package TestableIO.System.IO.Abstractions.Extensions --version 22.0.4
NuGet\Install-Package TestableIO.System.IO.Abstractions.Extensions -Version 22.0.4
<PackageReference Include="TestableIO.System.IO.Abstractions.Extensions" Version="22.0.4" />
<PackageVersion Include="TestableIO.System.IO.Abstractions.Extensions" Version="22.0.4" />
<PackageReference Include="TestableIO.System.IO.Abstractions.Extensions" />
paket add TestableIO.System.IO.Abstractions.Extensions --version 22.0.4
#r "nuget: TestableIO.System.IO.Abstractions.Extensions, 22.0.4"
#addin nuget:?package=TestableIO.System.IO.Abstractions.Extensions&version=22.0.4
#tool nuget:?package=TestableIO.System.IO.Abstractions.Extensions&version=22.0.4
Convenience functionality on top of System.IO.Abstractions
dotnet add package TestableIO.System.IO.Abstractions.Extensions
Examples
CurrentDirectory extension
var fs = new FileSystem();
//with extension
var current = fs.CurrentDirectory();
//without extension
var current = fs.DirectoryInfo.FromDirectoryName(fs.Directory.GetCurrentDirectory());
SubDirectory extension
var current = new FileSystem().CurrentDirectory();
//create a "temp" subdirectory with extension
current.SubDirectory("temp").Create();
//create a "temp" subdirectory without extension
current.FileSystem.DirectoryInfo.FromDirectoryName(current.FileSystem.Path.Combine(current.FullName, "temp")).Create();
File extension
var current = new FileSystem().CurrentDirectory();
//create a "test.txt" file with extension
using (var stream = current.File("test.txt").Create())
stream.Dispose();
//create a "test.txt" file without extension
using (var stream = current.FileSystem.FileInfo.FromFileName(current.FileSystem.Path.Combine(current.FullName, "test.txt")).Create())
stream.Dispose();
Automatic cleanup with Disposable extensions
Use CreateDisposableDirectory
or CreateDisposableFile
to create a IDirectoryInfo
or IFileInfo
that's automatically
deleted when the returned IDisposable
is disposed.
var fs = new FileSystem();
//with extension
using (fs.CreateDisposableDirectory(out IDirectoryInfo dir))
{
Console.WriteLine($"This directory will be deleted when control leaves the using block: '{dir.FullName}'");
}
//without extension
var temp = fs.Path.GetTempPath();
var fileName = fs.Path.GetRandomFileName();
var path = fs.Path.Combine(temp, fileName);
try
{
IDirectoryInfo dir = fs.Directory.CreateDirectory(path);
Console.WriteLine($"This directory will be deleted in the finally block: '{dir.FullName}'");
}
finally
{
fs.Directory.Delete(path, recursive: true);
}
IDirectoryInfo.CopyTo extension
var fs = new FileSystem();
var current = fs.CurrentDirectory();
//source
var source = current.SubDirectory("source");
source.Create(); //make sure the source directory exists
//destination
var dest = current.SubDirectory("destination");
//copy
source.CopyTo(dest, recursive: true);
Product | Versions 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
.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 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. 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. |
-
.NETFramework 4.7.2
- TestableIO.System.IO.Abstractions (>= 22.0.14)
-
.NETStandard 2.0
- TestableIO.System.IO.Abstractions (>= 22.0.14)
-
.NETStandard 2.1
- TestableIO.System.IO.Abstractions (>= 22.0.14)
-
net8.0
- TestableIO.System.IO.Abstractions (>= 22.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on TestableIO.System.IO.Abstractions.Extensions:
Repository | Stars |
---|---|
recyclarr/recyclarr
Automatically sync TRaSH Guides to your Sonarr and Radarr instances
|
Version | Downloads | Last Updated |
---|---|---|
22.0.4 | 619 | 12 days ago |
22.0.3 | 236,622 | 4 months ago |
22.0.2 | 251 | 4 months ago |
22.0.1 | 150 | 4 months ago |
2.2.6 | 296 | 4 months ago |
2.2.5 | 59,607 | 3/8/2024 |
2.2.4 | 326 | 3/1/2024 |
2.2.3 | 471 | 2/27/2024 |
2.2.1 | 2,291 | 1/4/2024 |
2.1.3 | 1,995 | 12/24/2023 |
2.1.2 | 193 | 12/24/2023 |
2.1.1 | 383 | 12/10/2023 |
2.0.5 | 9,133 | 8/22/2023 |
2.0.4 | 181 | 8/20/2023 |
2.0.3 | 197 | 8/20/2023 |
2.0.2 | 185 | 8/19/2023 |
2.0.1 | 310 | 8/19/2023 |
1.0.43 | 1,322 | 8/8/2023 |
1.0.42 | 10,535 | 3/19/2023 |
1.0.41 | 250 | 3/19/2023 |
1.0.40 | 254 | 3/19/2023 |
1.0.39 | 5,567 | 12/16/2022 |
1.0.38 | 346 | 12/16/2022 |
1.0.37 | 333 | 12/16/2022 |
1.0.36 | 323 | 12/16/2022 |
1.0.35 | 334 | 12/16/2022 |
1.0.34 | 1,714 | 11/27/2022 |
1.0.32 | 12,924 | 4/1/2022 |
1.0.30 | 471 | 3/30/2022 |
1.0.28 | 499 | 3/12/2022 |
1.0.24 | 486 | 3/11/2022 |
1.0.23 | 488 | 3/11/2022 |
1.0.22 | 468 | 3/11/2022 |
1.0.21 | 487 | 3/11/2022 |
1.0.20 | 501 | 3/11/2022 |
1.0.19 | 462 | 3/11/2022 |
1.0.17 | 475 | 3/8/2022 |
1.0.16 | 471 | 3/8/2022 |
1.0.14 | 520 | 11/11/2021 |
# Release Notes
List of notable changes between majors
## 22.0.0
- (Breaking) Removed support for some Async calls in .NET Framework and
legacy versions of .NET to better support .NET 8 and later
- Minimum required TestableIO.System.IO.Abstractions version is now 22.x
- Removed .NET 7 build (should still work with .NET standard build)
- Removed .NET 6 build (should still work with .NET standard build)
## 2.0.0
- (Breaking) Moved all extensions methods to 'System.IO.Abstractions' namespace
- Added ThrowIfNotFound extension methods
- Removed .NET 5 build (should still work with .NET standard build)