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...

ClaimExtensions Methods

Name Description
Public methodStatic member GetClaim Gets a claim from a list of claims
Public methodStatic member GetClaimValue Gets the value of the requested claim if it exists
Public methodStatic member HasRole Determines whether the specified role name has role.
Public methodStatic member HasRoles Determines whether the specified role name has roles.
Public methodStatic member UpdateClaim Updates a claim with a new value

Crypto

Name Description
Public methodStatic member BytesToHex Byteses to hexadecimal.
Public methodStatic member Decrypt Decrypts the specified data.
Public methodStatic member Encrypt Encrypts the specified data.
Public methodStatic member HexToBytes Hexadecimals to bytes.
Public methodStatic member RandomString Randoms the string (lowercase string)

DateExtensions Methods

Name Description
Public methodStatic member AscensionDay Calculate Ascencion day
Public methodStatic member AshWednesday Calculate Ash Wednesday
Public methodStatic member ChristmasDay Get the first day of christmas
Public methodStatic member DateDiff Dates the difference.
Public methodStatic member EasterSunday Calculate Easter Sunday day
Public methodStatic member FirstSundayOfAdvent Calculate the first Sunday of Advent
Public methodStatic member GetRandomDateTime Generate random DateTime between range
Public methodStatic member GoodFriday Calculate Good Friday
Public methodStatic member PalmSunday Calculate Palm Sunday
Public methodStatic member WhitSunday Calculate Whit Sunday

EnumerableExtensions Methods

Name Description
Public methodStatic member PickRandom<T>(IEnumerable<T>) Return a random item for an IEnumerable T
Public methodStatic member PickRandom<T>(IEnumerable<T>, Int32) Return a random item for an IEnumerable T
Public methodStatic member Shuffle<T>) Return source ordered by a new Guid

EnumExtension Methods

Name Description
Public methodStatic member GetLocalizedDescription Gets localized description
Public methodStatic member GetDescription<T> Gets the description.
Public methodStatic member ToEnum<T>(String) Extension method to return an enum value of type T for the given string.
Public methodStatic member ToEnum<T>(Int32) Extension method to return an enum value of type T for the given int.

ExpressionExtensions Methods

Name Description
Public methodStatic member And<T> Combines the first predicate with the second using the logical "and".
Public methodStatic member BuildPredicate<T> Builds the predicate.
Public methodStatic member Not<T> Negates the predicate.
Public methodStatic member Or<T> Combines the first predicate with the second using the logical "or".
Public methodStatic member Replace Replaces the specified search ex.

JsonSerializationExtension Methods

Name Description
Public methodStatic member ReadFromJsonFile<T> Reads an object instance from an Json file. Object type must have a parameterless constructor.
Public methodStatic member 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
Public methodStatic member TrimSpace Remove spece for each element of a list of string

StringExtensions Methods

Name Description
Public methodStatic member CheckIPValid Checks the ip valid.
Public methodStatic member ExtractDomainNameFromURL Extract a domain name from a full URL
Public methodStatic member GetLast Gets the last.
Public methodStatic member IPToNumber Gets a number from a IPv4
Public methodStatic member IsDate Determines whether the specified date is date.
Public methodStatic member IsNumeric Is the numeric.
Public methodStatic member PadNumber Pads the number.
Public methodStatic member RandomString Returns a random string with random alphanumeric characters
Public methodStatic member RemoveSpecialCharacter Replace special character with another string
Public methodStatic member ReplaceSpace Replace spaces with another string
Public methodStatic member ReplaceSpecialCharacters Replace non-ASCII characters with their ASCII value
Public methodStatic member Right Return the last n characters from a string
Public methodStatic member StripHTML Remove all HTML tags from a string
Public methodStatic member SubstringBetween Takes a substring between two anchor strings (or the end of the string if that anchor is null)
Public methodStatic member TruncateString(String, Int32) Truncate a string after maxLength characters.
Public methodStatic member TruncateString(String, Int32, Boolean) Truncate a string after maxLength characters.