/CsharpExtras

C# library for extra general purpose functionality not found in the standard libraries.

Primary LanguageC#MIT LicenseMIT

.NET Core Total alerts Language grade: C# project version on nuget

C# Extras

This library contains general-purpose functionality built on top of the .NET Standard libraries. Much of the code was inspired writing Excel VSTO AddIns using the Excel Interop libraries. However, this code is intentionally abstracted away from such libraries and thus can be used anywhere that's compatible with the .NET Standard framework.

Including C# Extras in Your Project

It is recommended to use NuGet to include C# Extras in your project. All releases and pre-releases are listed here; note: there are many v2 prereleases - this is because at the moment I do not plan to release v2.0.0 unless this library gets full-time support; at that point (if it happens) the plan would be to create milestones, do all the necessary refactoring, and release the next major version. More info on the versioning/release-strategy can be found on this Wiki page, although it's mostly just semantic versioning.

The NuGet page for CsharpExtras is here.

How to Use

  • The code is documented in many places, but unfortunately documentation came a bit late so it is not comprehensive. There is a TODO item for that.
  • There is an example application included in this repo that shows some of the code in action.
  • The Wiki has some DotNetFiddle examples demonstrating the code in action - these allow you to interact with the C# Extras code in your browser.

Contributing

See Contributing.md

Logging

The library supports injecting a logger object to be used to log issues using the API. To avoid dependencies on any particular logging library, the logger instance used should implement the CsharpExtras.Log.ILogger interface.

To inject a logger:

CsharpExtrasApi api = new CsharpExtrasApiImpl();
ILogger logger = // ...
api.SetLogger(logger);

The logger can be set to null to disable logging.

Redundancy & Bugs

Some of the code in this library may be redundant - there may be a more idiomatic way to achieve the same results in standard C#. Also, there may be performance issues or even bugs in the code. If you notice any such issues - feel free to submit an issue as per Contributing Guidelines.