ArturRios.Util 1.4.2

dotnet add package ArturRios.Util --version 1.4.2
                    
NuGet\Install-Package ArturRios.Util -Version 1.4.2
                    
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="ArturRios.Util" Version="1.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ArturRios.Util" Version="1.4.2" />
                    
Directory.Packages.props
<PackageReference Include="ArturRios.Util" />
                    
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 ArturRios.Util --version 1.4.2
                    
#r "nuget: ArturRios.Util, 1.4.2"
                    
#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 ArturRios.Util@1.4.2
                    
#: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=ArturRios.Util&version=1.4.2
                    
Install as a Cake Addin
#tool nuget:?package=ArturRios.Util&version=1.4.2
                    
Install as a Cake Tool

Dotnet Util

Docs License: MIT NuGet

Utilities for common development tasks in .NET: console output helpers, flow control (conditions, retries, and waiters), hashing (Argon2id), file I/O helpers, HTTP client helpers, math utilities, random values and strings, regex helpers, and small collections.

Installation

dotnet add package ArturRios.Util

The package targets net10.0 and depends on ArturRios.Output, which provides result envelopes.

Quickstart

  • Collections

    using ArturRios.Util.Collections;
    Console.WriteLine($"{AnsiColors.Green}Success!\x1b[0m");
    var pool = Characters.Digits + Characters.UpperLetters;
    
  • Console

    using ArturRios.Util.Console;
    CustomConsole.WriteCharLine();          // 100 dashes
    CustomConsole.WriteCharLine('=', 40);   // 40 equals signs
    
  • FlowControl

    using ArturRios.Util.FlowControl;
    using ArturRios.Util.FlowControl.Waiter;
    
    Condition.Create
      .True(user is not null).FailsWith("User is required")
      .True(emailValid).FailsWith("Invalid email")
      .ThrowIfNotSatisfied();
    
    Retry.New.MaxAttempts(3).DelayMilliseconds(200).Execute(() => DoFragileWork());
    var result = Retry.New.MaxAttempts(5).Execute(() => Compute());
    
    var waiter = new JitteredWaiter(maxRetryCount: 5);
    while (waiter.CanRetry)
    {
        try { await TryOperationAsync(); break; }
        catch { await waiter.Wait(); }
    }
    
  • Hashing

    using ArturRios.Util.Hashing;
    var hash = Hash.EncodeWithRandomSalt("secret", out var salt);
    var ok = Hash.TextMatches("secret", hash, salt);
    
  • Http

    using ArturRios.Util.Http;
    var gateway = new HttpGateway(httpClient);
    var output = await gateway.GetAsync<MyResponse>("/api/items");
    if ((int)output.StatusCode == HttpStatusCodes.Ok)
        Console.WriteLine(output.Body);
    
  • IO

    using ArturRios.Util.IO;
    var text  = FileReader.Read(path);
    var lines = FileReader.ReadLines(path);
    var dict  = FileReader.ReadAsDictionary(path, ',');
    var obj   = FileReader.ReadAndDeserialize<MyType>(jsonPath);
    // Async variants available on FileReaderAsync
    
  • Math

    using ArturRios.Util.Math;
    bool isPrime = PrimeUtils.IsPrimeNumber(7919); // true
    var generator = new PrimeGenerator<int>();
    Console.WriteLine(generator.Next()); // 2
    Console.WriteLine(generator.Next()); // 3
    
  • Random

    using ArturRios.Util.Random;
    var n   = CustomRandom.NumberFromRng(1, 10);
    var n2  = CustomRandom.NumberFromSystemRandom(0, 100, differentFrom: 42);
    var pwd = CustomRandom.Text(new RandomStringOptions { Length = 16, IncludeSpecialCharacters = true });
    
  • RegularExpressions

    using ArturRios.Util.RegularExpressions;
    var isEmail = RegexCollection.Email().IsMatch("john@doe.com");
    var stripped = RegexCollection.HasNumber().Remove("abc123def"); // "abcdef"
    

Documentation

Full API reference, class diagrams, and usage examples:

Versioning

Semantic Versioning (SemVer). Breaking changes result in a new major version. New methods or non-breaking behavior changes increment the minor version; fixes or tweaks increment the patch.

Build, test and publish

Use the official .NET CLI to build, test and publish the project and Git for source control. If you want, optional helper toolsets I built to facilitate these tasks are available:

This project is licensed under the MIT License. A copy of the license is available at LICENSE in the repository.

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.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on ArturRios.Util:

Package Downloads
ArturRios.Extensions

A small, focused set of C# extension methods that make every day .NET work more pleasant.

ArturRios.Util.WebApi

Utilities for developing web API's in .NET

ArturRios.Logging

A custom log solution

ArturRios.Util.Test

Test utilities for .NET projects: custom xUnit assertions and environment-aware test attributes, in-memory repository and scheduler fakes, and a base class for functional web API tests.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.2 39 7/24/2026
1.4.1 38 7/23/2026
1.4.0 64 7/23/2026
1.3.0 89 7/21/2026
1.2.0 169 6/26/2026
1.1.0 310 12/15/2025
1.0.0 272 12/5/2025