We have just released a lot of functions for .NET5 in a NuGet package that you can download for free. We collected in this package functions for everyday work to help you with claim, strings, enums, date and time, expressions…
You can browse the full documentation here.
ClaimExtensions Methods
Name | Description | |
---|---|---|
GetClaim | Gets a claim from a list of claims | |
GetClaimValue | Gets the value of the requested claim if it exists | |
HasRole | Determines whether the specified role name has role. | |
HasRoles | Determines whether the specified role name has roles. | |
UpdateClaim | Updates a claim with a new value |
Crypto
Name | Description | |
---|---|---|
BytesToHex | Byteses to hexadecimal. | |
Decrypt | Decrypts the specified data. | |
Encrypt | Encrypts the specified data. | |
HexToBytes | Hexadecimals to bytes. | |
RandomString | Randoms the string (lowercase string) |
DateExtensions Methods
Name | Description | |
---|---|---|
AscensionDay | Calculate Ascencion day | |
AshWednesday | Calculate Ash Wednesday | |
ChristmasDay | Get the first day of christmas | |
DateDiff | Dates the difference. | |
EasterSunday | Calculate Easter Sunday day | |
FirstSundayOfAdvent | Calculate the first Sunday of Advent | |
GetRandomDateTime | Generate random DateTime between range | |
GoodFriday | Calculate Good Friday | |
PalmSunday | Calculate Palm Sunday | |
WhitSunday | Calculate Whit Sunday |
EnumerableExtensions Methods
Name | Description | |
---|---|---|
PickRandom<T>(IEnumerable<T>) | Return a random item for an IEnumerable T | |
PickRandom<T>(IEnumerable<T>, Int32) | Return a random item for an IEnumerable T | |
Shuffle<T>) | Return source ordered by a new Guid |
EnumExtension Methods
Name | Description | |
---|---|---|
GetLocalizedDescription | Gets localized description | |
GetDescription<T> | Gets the description. | |
ToEnum<T>(String) | Extension method to return an enum value of type T for the given string. | |
ToEnum<T>(Int32) | Extension method to return an enum value of type T for the given int. |
ExpressionExtensions Methods
Name | Description | |
---|---|---|
And<T> | Combines the first predicate with the second using the logical "and". | |
BuildPredicate<T> | Builds the predicate. | |
Not<T> | Negates the predicate. | |
Or<T> | Combines the first predicate with the second using the logical "or". | |
Replace | Replaces the specified search ex. |
JsonSerializationExtension Methods
Name | Description | |
---|---|---|
ReadFromJsonFile<T> | Reads an object instance from an Json file. Object type must have a parameterless constructor. | |
WriteToJsonFile<T> | Writes the given object instance to a Json file. Object type must have a parameterless constructor.Only Public properties and variables will be written to the file. These can be any type though, even other classes.If there are public properties/variables that you do not want written to the file, decorate them with the [JsonIgnore] attribute. |
ListExtensions Methods
Name | Description | |
---|---|---|
TrimSpace | Remove spece for each element of a list of string |
StringExtensions Methods
Name | Description | |
---|---|---|
CheckIPValid | Checks the ip valid. | |
ExtractDomainNameFromURL | Extract a domain name from a full URL | |
GetLast | Gets the last. | |
IPToNumber | Gets a number from a IPv4 | |
IsDate | Determines whether the specified date is date. | |
IsNumeric | Is the numeric. | |
PadNumber | Pads the number. | |
RandomString | Returns a random string with random alphanumeric characters | |
RemoveSpecialCharacter | Replace special character with another string | |
ReplaceSpace | Replace spaces with another string | |
ReplaceSpecialCharacters | Replace non-ASCII characters with their ASCII value | |
Right | Return the last n characters from a string | |
StripHTML | Remove all HTML tags from a string | |
SubstringBetween | Takes a substring between two anchor strings (or the end of the string if that anchor is null) | |
TruncateString(String, Int32) | Truncate a string after maxLength characters. | |
TruncateString(String, Int32, Boolean) | Truncate a string after maxLength characters. |