AaTurpin.Utilities
1.0.0
dotnet add package AaTurpin.Utilities --version 1.0.0
NuGet\Install-Package AaTurpin.Utilities -Version 1.0.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="AaTurpin.Utilities" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AaTurpin.Utilities" Version="1.0.0" />
<PackageReference Include="AaTurpin.Utilities" />
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 AaTurpin.Utilities --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AaTurpin.Utilities, 1.0.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.
#addin nuget:?package=AaTurpin.Utilities&version=1.0.0
#tool nuget:?package=AaTurpin.Utilities&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AaTurpin.Utilities
A comprehensive .NET utility library providing robust helper methods for common DateTime and file path operations.
Installation
Install the package via NuGet Package Manager:
Install-Package AaTurpin.Utilities
Or via the .NET CLI:
dotnet add package AaTurpin.Utilities
Features
DateTimeUtils
Static utility class for common DateTime operations with ISO 8601 compliance:
- Get first day of week (using ISO 8601 standard where Monday is the first day)
- Get last day of week (using ISO 8601 standard where Sunday is the last day)
- Get ISO 8601 week number for a given date
- Get first and last day of month
PathUtils
Comprehensive static utility class for file path operations and manipulations:
- Path normalization for consistent comparison
- Drive letter normalization
- UNC path handling
- Path safety conversion for saving paths as filenames
- Relative path calculation
- Directory existence checks with auto-creation
- Safe path combination logic
Usage Examples
DateTimeUtils
using AaTurpin.Utilities;
using System;
// Get the first day (Monday) of the current week
DateTime monday = DateTimeUtils.GetFirstDayOfWeek(DateTime.Today);
// Get the last day (Sunday) of the current week
DateTime sunday = DateTimeUtils.GetLastDayOfWeek(DateTime.Today);
// Get the ISO 8601 week number
int weekNumber = DateTimeUtils.GetIso8601WeekOfYear(DateTime.Today);
// Get the first day of the current month
DateTime firstDayOfMonth = DateTimeUtils.GetFirstDayOfMonth(DateTime.Today);
// Get the last day of the current month
DateTime lastDayOfMonth = DateTimeUtils.GetLastDayOfMonth(DateTime.Today);
PathUtils
using AaTurpin.Utilities;
using System;
// Normalize paths for consistent comparison
string normalizedPath = PathUtils.NormalizePath(@"C:\Users\Username\Documents\");
// Result: "c:\users\username\documents"
// Extract server name from UNC path
string serverName = PathUtils.ExtractServerFromUncPath(@"\\Server01\Share\Folder");
// Result: "Server01"
// Convert standard path to filesystem-safe format (for storage)
string safePath = PathUtils.ConvertToFileSystemSafePath(@"C:\Project Files\Document.docx");
// Result: "C\Project Files\Document.docx"
// Restore original path from filesystem-safe format
string originalPath = PathUtils.RestoreFromFileSystemSafePath(@"C\Project Files\Document.docx");
// Result: "C:\Project Files\Document.docx"
// Get relative path
string relativePath = PathUtils.GetRelativePath(@"C:\Projects\MyProject\src\file.cs", @"C:\Projects\MyProject");
// Result: "src\file.cs"
// Ensure directory exists (creates if needed)
bool dirExists = PathUtils.EnsureDirectoryExists(@"C:\Temp\NewFolder");
// Ensure directory exists for a file (creates parent directory if needed)
bool parentDirExists = PathUtils.EnsureDirectoryExistsForFile(@"C:\Temp\NewFolder\file.txt");
// Combine path segments safely
string combinedPath = PathUtils.CombinePath("C:", "Users", "Username", "Documents");
// Result: "C:\Users\Username\Documents"
Requirements
- .NET Framework 4.7.2 or higher
- Compatible with .NET Standard 2.0+ projects
License
MIT License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- 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.0.0 | 117 | 4/30/2025 |
Initial Release.