![]() |
VOOZH | about |
dotnet add package Netrilo.Infrastructure.Common.Extensions --version 1.0.4
NuGet\Install-Package Netrilo.Infrastructure.Common.Extensions -Version 1.0.4
<PackageReference Include="Netrilo.Infrastructure.Common.Extensions" Version="1.0.4" />
<PackageVersion Include="Netrilo.Infrastructure.Common.Extensions" Version="1.0.4" />Directory.Packages.props
<PackageReference Include="Netrilo.Infrastructure.Common.Extensions" />Project file
paket add Netrilo.Infrastructure.Common.Extensions --version 1.0.4
#r "nuget: Netrilo.Infrastructure.Common.Extensions, 1.0.4"
#:package Netrilo.Infrastructure.Common.Extensions@1.0.4
#addin nuget:?package=Netrilo.Infrastructure.Common.Extensions&version=1.0.4Install as a Cake Addin
#tool nuget:?package=Netrilo.Infrastructure.Common.Extensions&version=1.0.4Install as a Cake Tool
Part of the Netrilo.Infrastructure SDK
Netrilo.Infrastructure.Common.Extensions is a collection of extension methods, utilities, validators, and infrastructure helpers for .NET applications.
It provides ready-to-use helpers for:
Sha256: Compute SHA-256 hash for byte arrays.QueryString: Convert objects into query string format.ToCamelCase, ToPascalCase, ToSnakeCase, ToKebabCase, ToTrainCase.Sha256: Compute SHA-256 hash from a string.StringExtensions: Additional helpers for null/empty checks and transformations.PathUtilitiesExtension: Normalize and validate file paths.InvalidDirectorySeperatorCharException.AppSettingsBase: Base class for strongly-typed app settings.IAppSettings, IGlobalSettings, IWorkerSettings..env files).[EnvName] attribute for mapping environment variables to properties.MailAddressConverter: JSON support for System.Net.Mail.MailAddress.AppLogger: lightweight structured logger for apps and services.ValidationBase.IsValidMobileNumber(ulong): Validates international mobile numbers using libphonenumber-csharp.Install from NuGet:
dotnet add package Netrilo.Infrastructure.Common.Extensions
Or reference the project in your solution.
using Netrilo.Infrastructure.Common.Extensions.String;
"hello world".ToCamelCase(); // "helloWorld"
"hello world".ToPascalCase(); // "HelloWorld"
"hello world".ToSnakeCase(); // "hello_world"
"hello world".ToKebabCase(); // "hello-world"
"hello world".ToTrainCase(); // "Hello-World"
using Netrilo.Infrastructure.Common.Extensions.String;
string password = "Secret123";
string hash = password.ToSha256();
using Netrilo.Infrastructure.Common.Extensions.ByteArray;
byte[] data = Encoding.UTF8.GetBytes("Hello");
string hash = data.ToSha256();
using Netrilo.Infrastructure.Common.Extensions.Object;
var user = new { Name = "Alice", Age = 30 };
string qs = user.ToQueryString();
// "Name=Alice&Age=30"
using Netrilo.Infrastructure.Common.Extensions.PathUtilities;
string path = "C:/invalid\\path";
string normalized = path.NormalizeDirectorySeparators();
public class DbSettings : AppSettingsBase, IAppSettings
{
public string ConnectionString { get; set; }
}
using Netrilo.Infrastructure.Common.Extensions.Tools;
DotEnv.Load(".env");
string dbHost = Environment.GetEnvironmentVariable("DB_HOST");
With annotations:
public class DbConfig
{
[EnvName("DB_HOST")]
public string Host { get; set; }
}
var options = new JsonSerializerOptions();
options.Converters.Add(new MailAddressConverter());
var mail = new MailAddress("user@example.com");
string json = JsonSerializer.Serialize(mail, options);
var logger = new AppLogger();
logger.Info("Application started");
logger.Error("Unexpected error", ex);
using Netrilo.Infrastructure.Common.Extensions.Validators;
ulong number = 14155552671; // US number
bool valid = ValidationBase.IsValidMobileNumber(number);
Console.WriteLine(valid); // true if valid
Run the following command to run the tests:
dotnet test .\Tests\Netrilo.Infrastructure.Common.Extensions.UnitTests\Netrilo.Infrastructure.Common.Extensions.UnitTests.csproj
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.