Fluxera.Utilities
                             
                            
                                9.2.0
                            
                        
                            
                                
                                
                                    Prefix Reserved
                                
                            
                    dotnet add package Fluxera.Utilities --version 9.2.0
NuGet\Install-Package Fluxera.Utilities -Version 9.2.0
<PackageReference Include="Fluxera.Utilities" Version="9.2.0" />
<PackageVersion Include="Fluxera.Utilities" Version="9.2.0" />
<PackageReference Include="Fluxera.Utilities" />
paket add Fluxera.Utilities --version 9.2.0
#r "nuget: Fluxera.Utilities, 9.2.0"
#:package Fluxera.Utilities@9.2.0
#addin nuget:?package=Fluxera.Utilities&version=9.2.0
#tool nuget:?package=Fluxera.Utilities&version=9.2.0
Fluxera.Utilities
A collection of common utilities and extension methods.
This is the place for all "common" helpers, extension methods and utilities. There is only one condition: The helpers may not require any third party packages.
Available Helpers
- AsyncHelperRun async method in a synchonous context.
- RandomHelperUseful randomizing methods.
- TempPathHelperCreate temp files or folders safely.
- DisposableBase class that implements- IDisposablecorrectly.
Available Collections
- SortedList- IList<T>implementation that inserts the items sorted using binary search.
Available Extensions Methods
There are a lot of extensions methods available. here we sort them by the type they are implemented on.
Array
- IsIndexWithinChecks if the given index is within the array.
- ToMemoryStreamCreates a- MemoryStreamfrom a byte array.
Assembly
- GetResourceAsStringAsyncGets the content of the given embedded resource location as string.
Character
- RepeatRepeats the given- charthe specified number of times.
Collection
- AddIfNotContainsAdds item(s) to collection if they are not already in the collection.
- IsNullOrEmptyChecks if the collection is null or empty.
- RemoveMatchingRemoves all items from the collection that match a given predicate.
String Conversions
The custom interfaces IConverter and ITryConverter provide a fluent interface for
converting strings to numeric, boolean and Guid values.
string value = "5";
int result = value.Convert().ToInt();
string value = "5";
bool success = value.TryConvert().ToInt(out int result);
char value = '5';
int result = value.Convert().ToInt();
char value = '5';
bool success = value.TryConvert().ToInt(out int result);
The Convert() extension methods also provide overloads to provide a custom IFormatProvider. The default format provider is CultureInfo.CurrentCulture.
DateTime
- AddMonthsToEndOfMonthAdds the months to end of month.
- AddWeeksAdds an amount of weeks to a date value.
- CalculateAgeCalculates the age based on a passed reference date.
- GetDayCountOfYearGet the number of days within that date year.
- GetDaysGet the number of days between two dates.
- GetDaysOfMonthCountReturns the number of days in the month of a provided date.
- GetFirstDayOfMonthReturns the first day of the month of a provided date.
- GetFirstDayOfWeekGets the first day of the week using a specific culture.
- GetLastDayOfMonthReturns the last day of the month of a provided date.
- GetLastDayOfWeekGets the last day of the week using a specific culture.
- GetNextWeekdayGets the next occurrence of the specified weekday.
- GetPeriodOfDayReturns the period of the day- PeriodOfDay.Morning,- PeriodOfDay.Afternoon,- PeriodOfDay.Evening.
- GetPreviousWeekdayGets the previous occurrence of the specified weekday.
- GetWeekOfYearGets the week number for a date time value based on the current culture settings.
- GetWeeksWeekdayGets the next occurrence of a specified weekday within the current week using a specific culture.
- IsDateEqualDetermines if the date part of two- DateTimevalues are equal.
- IsLeapYearReturns if or not a- DateTimeis during a leap year.
- IsTimeEqualDetermines if the time part of two- DateTimevalues are equal.
- IsTodayDetermines if a date is- DateTime.Today.
- IsWeekdayDetermines if a- DateTimeor- DayOfWeekis a weekday.
- **IsWeekend**Determines if aDateTimeorDayOfWeekis a weekend.
- MidnightGets a- DateTimerepresenting midnight on a specified date.
- NextMonthGets the next month.
- NoonGets a- DateTimerepresenting noon on a specified date.
- OrdinalSuffixConverts the day of a date to an ordinal string, f.e. 3 to '3rd'.
- SetTimeSets the time of the a- DateTimewith a specified precicion. All other parts are set to zero.
- ToUnixTimestampConverts a- DateTimeto a UNIX timestamp (seconds since 01.01.1970).
Dictionary
- ContainsValueReturns- trueif the value is contained in a dictionary.
- GetOrAddGets a value from a dictionary with given key. Returns a default value if the value cannot be found.
- GetOrDefaultGets a value from a dictionary. Returns- defaultif the value cannot be found.
- TryGetValueTries to get a value from a dictionary.
Enum
All operations utilize a cache of the enums metadata that is built lazily when using the extensions methods.
- EnumOptionsGets all options of an enum type.
- EnumValuesGets all values of an enum type.
- HasFlagA generic version of- Enum.HasFlag(enum)"
- IsEmptyGets a flag, indicating if the enum has no values.
- MaxValueGets the maximum value of the enum.
- MinValueGets the minimum value of the enum.
Enumerable
- AsReadOnlyConverts an enumerable to a read-only collection.
- ForEachExecutes an- Actionfor every item in the enumerable.
- IsAnyChecks if a enumerable is not null or empty.
- IsNullOrEmptyChecks if the enumerable is null or empty.
Guid
- IsEmptyChecks a- Guidis- Guid.Empty.
List
- AddForAdds a value to a list if the value matches a predicate.
- AddRangeAdds values to a list (- IList<T>).
- AddRangeForAdds values to a list if the value to add matches a predicate.
- AddRangeSortedAdds values into a list sorted.
- AddSortedAdds a value into a list sorted.
MemoryStream
- ToContentStringConverts the content of the memory stream to a string.
Nullable
- IsNullChecks if a nullable has no value.
Numeric
The numeric extensions methods are available for the following primitives: byte, short, int, long
- IsBetweenDetermines if a value is between the specified values a and b (inclusive).
- IsEvenDetermines whether a value is even.
- IsOddDetermines whether a value is odd.
- OrdinalizeOrdinalize a number, f.e. 6 to '6th'.
- TimesPerforms a specified action n times based on the value.
Object
- GetDefaultValueGets the type default value for a type. In case of reference types:- nulland for values types- default(T).
- IsNullReturns- true, if the specified target reference is equal to the null reference.
- LockingExecutes an- Actionby locking on a given object.
Principal
- GetClaimValueGets the first value of the given claim type and returns its value.
- GetClaimValuesGets all values of the given claim type and returns their values.
- GetDisplayNameGets the display name from the- ClaimsIdentityor uses the subject.
- GetSubjectIdGets the subject identifier.
- IsAuthenticatedDetermines whether a principal is authenticated.
Reflection
- DefinesAttributeReturns- trueif a- MemberInfoinstance is marked with the specified attribute.
- GetMemberTypeGets the underlying type of a- MemberInfoinstance.
- IsIndexerDetermines if a- PropertyInfois an indexer.
- IsPropertyDetermines if a- MethodInfois a property.
- IsPropertyGetterDetermines if a- MethodInfois a property getter.
- IsPropertySetterDetermines if a- MethodInfois a property setter.
Stream
- CopyToCopies a- Streaminto a another one.
- CopyToMemoryCopies a- Streaminto a local- MemoryStream.
- GetBytesGets all bytes of a- Stream.
- GetReaderOpens a- StreamReaderfor a- Stream.
- GetWriterOpens a- StreamWriterfor a- Stream.
- RewindRewinds (set the current position to 0) a- Stream.
- WriteWrites all bytes to the a- Stream.
String
- ConcatWithConcatenates a string with additional strings and an optional delimiter character.
- EnsureEndsWithEnsures that a string ends with a given suffix.
- EnsureStartsWithEnsures that a string starts with a given prefix.
- FormatInvariantWithApplies formatting to a string using the invariant culture.
- FormatWithApplies formatting to a string using the current culture.
- FromBase64Decodes a string from base64 to its normal representation.
- GetBytesConverts a string to a- byte[]using a specific encoding.
- IsNullOrEmptyDetermines if a string is- nullor- string.Empty.
- **IsNullOrWhiteSpace**Determines if a string isnullorstring.Emptyor consists of whitespace-only characters.
- IsNumericChecks if the contents of a string is a numeric value.
- LeftGets a substring of a string from beginning of the string.
- RemovePostFixRemoves the first occurrence of postfixes from the end of a string.
- RemovePrefixRemoves the first occurrence of prefixes from the beginning of a string.
- RemoveSpacesRemoves all whitespace (not line endings, etc.) from a string.
- RemoveSpecialCharactersRemoves all special characters from a string.
- RepeatRepeats a string value as provided by the repeat count.
- ReplaceDiacriticsReplaces all diacritical marks with an ascii representation, fe. '�' to 'u'.
- ReplaceWithEmptyReplaces all occurrences of a string in an input string with- string.Empty.
- **Reverse**Reverses the a string.
- RightGets a substring of a string from end of the string.
- SplitUses- string.Split(string[], StringSplitOptions)method to split a string by a separator.
- ToBase64Encodes string to base64.
- ToEnumConverts a string to a matching enum value of a given enum type.
- ToMemoryStreamConverts a string to a- MemoryStream.
- TruncateTruncates a string to a specified length and optionally replaces the truncated part with '...' suffix.
- UrlSafeDecodeEncodes a string for safe usage in URLs, f.e. for password reset or email confirmation tokens.
- UrlSafeEncodeDecodes a given URL-safe string.
Inflection
- PluralizeReturns the plural form of a word.
- SingularizeReturns the singular form of a word.
- TitleizeReturn a string in a form that can be used as title.
- HumanizeHumanizes a string.
- PascalizePascalizes a string.
- CamelizeCamelizes a string.
- UnderscoreReplaces all dashes with underscores.
- CapitalizeCapitalizes a string.
- UncapitalizeUncapitalizes a string.
- OrdinalizeOrdinalizes the given number that is given as string, f.e. '6' to '6th'.
- DasherizeConverts all underscores to dashes.
Type
- CreateInstanceCreates an instance of a type.
- DefinesAttributeReturns- trueif the type is marked with a specified attribute.
- GetBaseClassesGets all base classes recursively for a type.
- ImplementsReturns- trueif type implements a specified interface.
- IsAssignableToChecks if a type is assignable to another type.
- IsCollectionDetermines if the a type is a collection.
- IsEnumerableDetermines if the a type is an enumerable.
- IsNullableDetermines if the a type is a nullable.
- IsNumericDetermines if the a type is numeric.
- IsPrimitiveDetermines whether a type is a primitive.
- UnwrapNullableTypeGets the type without nullable if the type is a- Nullable<T>.
Uri
- GetSubDomainGets the sub-domain part from a- Uri.
ValueType
- IsDefaultDetermines if a value is empty (- default(T)).
- IsNullableDetermines if a type is a nullable.
- ToNullableonverts a value to a corresponding nullable type.
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | 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 was computed. 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. | 
- 
                                                    net8.0- No dependencies.
 
- 
                                                    net9.0- No dependencies.
 
NuGet packages (8)
Showing the top 5 NuGet packages that depend on Fluxera.Utilities:
| Package | Downloads | 
|---|---|
| Fluxera.Repository.Abstractions The abstractions for the generic repository implementation. | |
| Fluxera.Extensions.Hosting.Modules.AspNetCore A module that enables ASP.NET Core. | |
| Fluxera.Extensions.Hosting.Modules.DataManagement A module that enables data management. | |
| Fluxera.Extensions.Hosting.Modules.Domain.Shared A module that enables the domain. | |
| Fluxera.Extensions.Hosting.Modules.AutoMapper A module that enables object mapping using AutoMapper. | 
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 9.2.0 | 318 | 7/28/2025 | |
| 9.0.1 | 1,446 | 2/5/2025 | |
| 9.0.0 | 1,279 | 11/14/2024 | |
| 8.2.3 | 1,395 | 11/1/2024 | |
| 8.2.2 | 7,961 | 7/9/2024 | |
| 8.2.1 | 3,866 | 6/15/2024 | |
| 8.2.0 | 707 | 6/8/2024 | |
| 8.1.0 | 2,973 | 5/26/2024 | |
| 8.0.5 | 890 | 5/24/2024 | |
| 8.0.4 | 18,802 | 4/18/2024 | |
| 8.0.3 | 3,282 | 4/13/2024 | |
| 8.0.2 | 10,165 | 2/22/2024 | |
| 8.0.1 | 16,694 | 11/23/2023 | |
| 8.0.0 | 3,749 | 11/15/2023 | |
| 7.1.1 | 14,315 | 7/20/2023 | |
| 7.1.0 | 26,673 | 1/18/2023 | |
| 7.0.4 | 18,989 | 11/15/2022 | |
| 7.0.3 | 6,467 | 11/12/2022 | |
| 7.0.1 | 448 | 11/12/2022 | |
| 7.0.0 | 5,970 | 11/9/2022 | |
| 6.1.1 | 129,133 | 6/7/2022 | |
| 6.1.0 | 3,709 | 6/7/2022 | |
| 6.0.17 | 555 | 6/6/2022 | |
| 6.0.16 | 101,662 | 5/5/2022 | |
| 6.0.14 | 18,722 | 4/20/2022 | |
| 6.0.13 | 2,483 | 4/14/2022 | |
| 6.0.12 | 28,953 | 3/24/2022 | |
| 6.0.10 | 5,476 | 2/17/2022 | |
| 6.0.9 | 1,107 | 12/22/2021 | |
| 6.0.8 | 2,353 | 12/17/2021 | |
| 6.0.4 | 6,952 | 12/11/2021 | |
| 6.0.2 | 470 | 12/8/2021 |