C# extensions.


Keywords
extensions, andrew, c#, helper, methods, string, datetime, ci-sync, csharp, csproj
License
MIT
Install
Install-Package AB.Extensions -Version 4.0.0

Documentation

AB.Extensions

This is a C# extensions library that I maintain to help reduce errors in code that I find in the wild. It is free of dependencies, includes tests, benchmarks and light commentary on usage. Some methods are pulled from StackOverflow, but with fixed corner cases and added test coverage. Others are just functions that I've found helpful or grown tired of re-googling and copy-pasting. Some useful constant strings and dates are scattered throughout, for those who hate magic strings like me.

The source now officially lives in Azure DevOps, but is continuously pushed to Github via Azure Pipelines CI.

Builds by Azure Pipelines

Primary Build in Azure Pipelines

CI Sync to Github

CI Sync

Install the Package

Import easily by editing your csproj:

<PackageReference Include="AB.Extensions" Version="4.0.0" />

Alternatively with dotnet CLI:

dotnet add package AB.Extensions

CI Packaging Notes

The Azure Artifacts feed which hosts the prerelease packages (uploaded by CI) is publically available here.

If you prefer Myget, those are located here.

Release versions are automatically uploaded to Nuget.org by CI under the following conditions:

  • master branch
  • all previous steps succeeded in the build
  • manual queue of build
  • when manually queuing the build, a variable of name PushReleaseNuget should be provided with value confirm.

This means that when making new branches for code modifications, it's a good practice to immediately identify the desired SemVer in the csproj metadata, and ensure the code change adheres accordingly.

Apply Linting/Formatting

A dotnet local tool is present in the repo which can help keep formatting & linting adherent to the .editorconfig file, even if you don't have dotnet format installed.

dotnet tool restore;
dotnet tool run dotnet-format;