https://github.com/ultimaweapon/dotnet-extensions
A collection of lightweight .NET libraries for missing features
https://github.com/ultimaweapon/dotnet-extensions
csharp dotnet
Last synced: 2 months ago
JSON representation
A collection of lightweight .NET libraries for missing features
- Host: GitHub
- URL: https://github.com/ultimaweapon/dotnet-extensions
- Owner: ultimaweapon
- License: mit
- Created: 2022-05-18T15:43:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-13T01:56:32.000Z (about 3 years ago)
- Last Synced: 2025-03-18T07:11:24.828Z (over 1 year ago)
- Topics: csharp, dotnet
- Language: C#
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# .NET Extensions
This is a collection of lightweight .NET libraries providing some missing features. These libraries has been using on production environment of [Cloudsumé](https://cloudsume.com) so it is production ready.
## 📦 Ultima.Extensions.Collections
[](https://www.nuget.org/packages/Ultima.Extensions.Collections)
Provides additional types and methods for handle collections.
| Type | Description |
| --------------------- | ---------------------------------------------------------- |
| DictionaryExtensions | A collection of extension methods for `Dictionary`. |
| KeyedByTypeCollection | A collection to store unique items identified by its type. |
| TypeComparer | Provides implementations of `IComparer` for `Type`. |
## 📦 Ultima.Extensions.CommandLine
[](https://www.nuget.org/packages/Ultima.Extensions.CommandLine)
Provides some utilities and missing features for [System.CommandLine](https://www.nuget.org/packages/System.CommandLine).
| Type | Description |
| -------------- | ----------------------------------------------------------------------------- |
| CommandHandler | An implementation of `ICommandHandler` that automatic handle interupt signal. |
## 📦 Ultima.Extensions.Currency
[](https://www.nuget.org/packages/Ultima.Extensions.Currency)
Provides some types to handling currency.
| Type | Description |
| ------------ | ----------------------------------------- |
| CurrencyCode | Provides type safety for a currency code. |
| CurrencyInfo | Provides details for a currency. |
Available `CurrencyInfo` implementation:
| Type | Wikipedia |
| ------------------ | -------------------------------------------------- |
| Euro | https://en.wikipedia.org/wiki/Euro |
| IndianRupee | https://en.wikipedia.org/wiki/Indian_rupee |
| JapaneseYen | https://en.wikipedia.org/wiki/Japanese_yen |
| NigerianNaira | https://en.wikipedia.org/wiki/Nigerian_naira |
| PakistaniRupee | https://en.wikipedia.org/wiki/Pakistani_rupee |
| PhilippinePeso | https://en.wikipedia.org/wiki/Philippine_peso |
| SingaporeDollar | https://en.wikipedia.org/wiki/Singapore_dollar |
| SouthKoreanWon | https://en.wikipedia.org/wiki/South_Korean_won |
| Sterling | https://en.wikipedia.org/wiki/Pound_sterling |
| ThaiBaht | https://en.wikipedia.org/wiki/Thai_baht |
| UnitedStatesDollar | https://en.wikipedia.org/wiki/United_States_dollar |
**Please note that `CurrencyCode.Parse` will accept any valid currency, including a test currency with XTS code. You MUST check `CurrencyInfo.IsOfficial` when accepting a currency from the user.**
### Breaking changes
#### 1.0 to 2.0
`CurrencyCode` was changed from `struct` to `class`.
## 📦 Ultima.Extensions.DataValidation
[](https://www.nuget.org/packages/Ultima.Extensions.DataValidation)
Additionals `System.ComponentModel.DataAnnotations.ValidationAttribute` implementation.
| Type | Description |
| -------------------- | ------------------------------------------------------------- |
| NonNegativeAttribute | Specifies that the number must be greater or equal than zero. |
| PositiveAttribute | Specifies that the number must be greater than zero. |
| UniqueAttribute | Specifies that the item in a collection must be unique. |
## 📦 Ultima.Extensions.Json
[](https://www.nuget.org/packages/Ultima.Extensions.Json)
Provides additional types and methods to works with `System.Text.Json`.
### JsonConverter implementations
| Converter | Target type |
| -------------------- | -------------------------------- |
| CultureInfoConverter | System.Globalization.CultureInfo |
| MailAddressConverter | System.Net.Mail.MailAddress |
| RegionInfoConverter | System.Globalization.RegionInfo |
You can register the converter to want by adding its instance to `System.Text.Json.JsonSerializerOptions.Converters`. You can use `System.Text.Json.JsonSerializerOptions.AddSystemTypeConverters` extension method to register all of the additional converters.
### System.Text.Json.JsonSerializerOptions extension methods
| Method | Description |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------|
| AddSystemTypeConverters | Register all of additional converters. |
| NormalizeProperty | Normalize the specified property name according to `System.Text.Json.JsonSerializerOptions.PropertyNamingPolicy` if available. |
## 📦 Ultima.Extensions.Primitives
[](https://www.nuget.org/packages/Ultima.Extensions.Primitives)
Provides additional types to work with .NET fundamental types.
| Type | Description |
| ---------- | --------------------------------------------------------------------------- |
| UriBuilder | An alternative to `System.UriBuilder` with more powerful and easier to use. |
| Uuid | Provides some static methods to convert between Guid and UUID. |
| YearMonth | A struct to represent year and month without day. |
## 📦 Ultima.Extensions.Security
[](https://www.nuget.org/packages/Ultima.Extensions.Security)
Provides additional types and methods for types in `System.Security` namespace.
| Type | Description |
| -------------------------- | -------------------------------------------------------- |
| ClaimsPrincipalExtensions | A collection of extension methods for `ClaimsPrincipal`. |
## License
MIT