Skip to content

A collection of lightweight .NET libraries for missing features

License

Notifications You must be signed in to change notification settings

ultimicro/dotnet-extensions

Repository files navigation

.NET Extensions

This is a collection of lightweight .NET libraries providing some missing features. These libraries has been using on production environment of Cloudsumé so it is production ready.

📦 Ultima.Extensions.Collections

Nuget

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

Nuget (with prereleases)

Provides some utilities and missing features for System.CommandLine.

Type Description
CommandHandler An implementation of ICommandHandler that automatic handle interupt signal.

📦 Ultima.Extensions.Currency

Nuget

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

Nuget

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

Nuget

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

Nuget

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

Nuget

Provides additional types and methods for types in System.Security namespace.

Type Description
ClaimsPrincipalExtensions A collection of extension methods for ClaimsPrincipal.

License

MIT

About

A collection of lightweight .NET libraries for missing features

Topics

Resources

License

Stars

Watchers

Forks

Languages