Maestria.Extensions
3.9.0
See the version list below for details.
dotnet add package Maestria.Extensions --version 3.9.0
NuGet\Install-Package Maestria.Extensions -Version 3.9.0
<PackageReference Include="Maestria.Extensions" Version="3.9.0" />
<PackageVersion Include="Maestria.Extensions" Version="3.9.0" />
<PackageReference Include="Maestria.Extensions" />
paket add Maestria.Extensions --version 3.9.0
#r "nuget: Maestria.Extensions, 3.9.0"
#:package Maestria.Extensions@3.9.0
#addin nuget:?package=Maestria.Extensions&version=3.9.0
#tool nuget:?package=Maestria.Extensions&version=3.9.0
Maestria.Extensions
- What is Maestria.Extensions?
- What is Maestria Project?
- Where can I get it?
- How do I get started?
- Data Types
- Settings
- Full usage documentations
- Extra documentations
If my contributions helped you, please help me buy a coffee 😄
What is Maestria.Extensions?
Extension function pack to increase productivity and improve source code writing. By default, all extension methods are safe.
What is Maestria Project?
This library is part of Maestria Project.
Maestria is a project to provide productivity and elegance to your source code writing.
Where can I get it?
First, install NuGet. Then, install Maestria.Extensions from the package manager console:
PM> Install-Package Maestria.Extensions
or install from the dotnet cli command line:
> dotnet add package Maestria.Extensions
How do I get started?
First, import "Maestria.Extensions" reference:
using Maestria.Extensions;
Then in your application code, use fluent syntax:
// 1. Numeric rounding
using Maestria.Extensions;
decimal value = 3.14159m;
var rounded = value.Round(2); // 3.14
// Detailed: [Number extensions](docs/usage/number.md)
// 2. Range check
int score = 85;
bool isGradeB = score.Between(80, 89); // true
// Detailed: [Comparable extensions](docs/usage/comparable.md)
// 3. Enum display name
DayOfWeek day = DayOfWeek.Monday;
string name = day.GetDisplayName(); // "Monday"
// Detailed: [Enum extensions](docs/usage/enum.md)
// 4. Collection has items
var list = new[] { 1, 2, 3 };
bool has = list.HasItems(); // true
// Detailed: [Enumerable extensions](docs/usage/enumerable.md)
// 5. Exception messages
try { throw new InvalidOperationException("Invalid"); }
catch (Exception ex) { var msg = ex.GetAllMessages(); }
// Detailed: [Exception extensions](docs/usage/exception.md)
// 6. String trimming
string path = "/folder/";
var trimmed = path.TrimEnd("/"); // "/folder"
// Detailed: [String extensions](docs/usage/string.md)
// 7. XML escaping
string xml = "<tag>\"Value\" & More</tag>";
var escaped = xml.EscapeXml(); // "<tag>"Value" & More</tag>"
// Detailed: [String extensions](docs/usage/string.md)
// 8. Base64 encoding
string text = "hello";
var b64 = text.ToBase64(); // "aGVsbG8="
// Detailed: [String extensions](docs/usage/string.md)
// 9. Guid handling
Guid guid = Guid.Empty;
var newGuid = guid.IfEmpty().Then(Guid.NewGuid());
// Detailed: [Other extensions](docs/usage/other.md)
// 10. Pipeline example
var result = "12345"
.OnlyNumbers()
.Format("{0:###-##}"); // "123-45"
// Detailed: [String extensions](docs/usage/string.md)
Data Types
The library ships with two expressive result types that eliminate boilerplate error handling:
SimpleResult and SimpleResult<TValue>
// SimpleResult — implicit conversions keep method signatures clean
public SimpleResult Save(Order order)
{
if (order == null) return "Order cannot be null"; // implicit failure
// ...
return true; // implicit success
}
var result = Save(order);
if (result) Console.WriteLine("Saved!");
else Console.WriteLine(result.Message);
Try<TSuccess, TFailure>
// Try<TSuccess, TFailure> — distinct types for success and failure
public Try<OrderCreated, ValidationError> Submit(Order order) { ... }
var r = Submit(order);
if (r) Console.WriteLine($"Order ID: {r.Value.Id}");
else Console.WriteLine($"Error {r.Failure.Code}: {r.Failure.Message}");
See docs/usage/datatypes.md for full documentation, implicit conversion rules,
SimpleResult<T>, and advanced usage.
Settings
It's possible set default settings for library:
Extensions.GlobalSettings.Configure(cfg => cfg
.FloatAndDoubleTolerance(default-float-and-double-comparasion-tolerance) // Default is 0.00001f
Full usage documentations
There are many more extension methods available. See the full documentation:
| Topic | Samples methods |
|---|---|
| Comparable & fluent expressions | Between, In, LimitMinAt, LimitMaxAt, fluent If...Then, NullIf |
| Data types | SimpleResult, Try<TSuccess, TFailure> |
| Enum extensions | GetDisplayName, GetDescription, GetValues |
| Enumerable & collection extensions | HasItems, IsNullOrEmpty, Iterate, TryGetValue, WithIndex |
| Exception extensions | GetAllMessages, GetMostInner |
| Number extensions | Round, RoundUp, Truncate for numeric types |
| Other extensions | OutVar and pipeline helpers |
| String extensions | Trimming, substring, hashing, Base64, encoding, and more |
Extra documentations
See additional documentations at docs folder.
- changelog.md: List of changes by version and breaking changes.
- ci-workflow.md: Description of the CI workflow used in the project.
- contributing.md: How to contribute to the project.
If my contributions helped you, please help me buy a coffee 😄
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- JetBrains.Annotations (>= 2026.2.0)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net10.0
- JetBrains.Annotations (>= 2026.2.0)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net5.0
- JetBrains.Annotations (>= 2026.2.0)
-
net6.0
- JetBrains.Annotations (>= 2026.2.0)
-
net8.0
- JetBrains.Annotations (>= 2026.2.0)
-
net9.0
- JetBrains.Annotations (>= 2026.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.2 | 86 | 7/21/2026 |
| 4.0.1 | 94 | 7/20/2026 |
| 4.0.0 | 94 | 7/20/2026 |
| 3.9.1 | 87 | 7/18/2026 |
| 3.9.0 | 93 | 7/17/2026 |
| 3.8.13 | 124 | 7/1/2026 |
| 3.8.12 | 91 | 7/1/2026 |
| 3.8.11 | 90 | 7/1/2026 |
| 3.8.10 | 96 | 7/1/2026 |
| 3.8.9 | 105 | 6/30/2026 |
| 3.8.8 | 120 | 6/27/2026 |
| 3.8.7 | 116 | 6/23/2026 |
| 3.8.6 | 116 | 6/23/2026 |
| 3.8.5 | 114 | 6/23/2026 |
| 3.8.4 | 103 | 6/23/2026 |
| 3.8.3 | 116 | 6/23/2026 |
| 3.8.2 | 105 | 6/23/2026 |
| 3.8.1 | 108 | 6/23/2026 |
| 3.8.0 | 211 | 4/24/2026 |
| 3.7.2 | 701 | 11/12/2025 |


