ArturRios.Util
1.4.2
dotnet add package ArturRios.Util --version 1.4.2
NuGet\Install-Package ArturRios.Util -Version 1.4.2
<PackageReference Include="ArturRios.Util" Version="1.4.2" />
<PackageVersion Include="ArturRios.Util" Version="1.4.2" />
<PackageReference Include="ArturRios.Util" />
paket add ArturRios.Util --version 1.4.2
#r "nuget: ArturRios.Util, 1.4.2"
#:package ArturRios.Util@1.4.2
#addin nuget:?package=ArturRios.Util&version=1.4.2
#tool nuget:?package=ArturRios.Util&version=1.4.2
Dotnet Util
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 signsFlowControl
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 FileReaderAsyncMath
using ArturRios.Util.Math; bool isPrime = PrimeUtils.IsPrimeNumber(7919); // true var generator = new PrimeGenerator<int>(); Console.WriteLine(generator.Next()); // 2 Console.WriteLine(generator.Next()); // 3Random
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:
Legal Details
This project is licensed under the MIT License. A copy of the license is available at LICENSE in the repository.
| Product | Versions 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. |
-
net10.0
- ArturRios.Output (>= 3.1.0)
- Konscious.Security.Cryptography.Argon2 (>= 1.3.1)
- Newtonsoft.Json (>= 13.0.4)
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.