Extensions for the System.AppDomain
class.
public static class AppDomainExtensions
Type[] GetAllExportedTypes(this AppDomain appDomain)Summary: Gets all exported types.
Parameters:
appDomain
- The application domain.
AssemblyInformation[] GetAssemblyInformations(this AppDomain appDomain)Summary: Gets the assembly informations.
Parameters:
appDomain
- The application domain.Returns: The array of
Atc.Data.Models.AssemblyInformation
.
AssemblyInformation[] GetAssemblyInformationsByStartsWith(this AppDomain appDomain, string value)Summary: Gets the assembly informations by assembly fullname should start with value.
Parameters:
appDomain
- The application domain.
value
- The value.Returns: The array of
Atc.Data.Models.AssemblyInformation
.
AssemblyInformation[] GetAssemblyInformationsBySystem(this AppDomain appDomain)Summary: Gets the assembly informations by system.
Parameters:
appDomain
- The application domain.Returns: The array of
Atc.Data.Models.AssemblyInformation
.
Assembly[] GetCustomAssemblies(this AppDomain appDomain)Summary: Gets the custom assemblies - excluding System, Microsoft etc.
Parameters:
appDomain
- The application domain.Returns: The array of
System.Reflection.Assembly
.
Type GetExportedPropertyTypeByName(this AppDomain appDomain, string typeName, string propertyName)Summary: Gets the name of the exported property type by.
Parameters:
appDomain
- The application domain.
typeName
- Name of the type.
propertyName
- Name of the property.
Type GetExportedTypeByName(this AppDomain appDomain, string typeName)Summary: Gets the name of the exported type by.
Parameters:
appDomain
- The application domain.
typeName
- Name of the type.
bool TryLoadAssemblyIfNeeded(this AppDomain appDomain, string dllFileName)Summary: Load the specified assembly file, with a reference to memory and not the specified file.
Parameters:
appDomain
- The application domain.
dllFileName
- The name for the assembly file.Returns: The Assembly that is loaded.
Remarks: The assembly is never directly loaded, to avoid holding a instance as "assembly = Assembly.Load(file)" do.
ArgumentNullOrDefaultException.
public class ArgumentNullOrDefaultException : ArgumentException, ISerializable
ArgumentNullOrDefaultPropertyException.
public class ArgumentNullOrDefaultPropertyException : ArgumentException, ISerializable
ArgumentNullPropertyException.
public class ArgumentNullPropertyException : ArgumentException, ISerializable
ArgumentPropertyException.
public class ArgumentPropertyException : ArgumentException, ISerializable
ArgumentPropertyNullException.
public class ArgumentPropertyNullException : ArgumentException, ISerializable
Extensions for the System.Array
class.
public static class ArrayExtensions
Array RemoveDuplicates(this Array array)Summary: Removes the duplicates.
Parameters:
array
- The array.
Array ToArray(this Array array, SortDirectionType sortDirectionType = None, bool removeDuplicates = False)Summary: To the array.
Parameters:
array
- The array.
sortDirectionType
- Type of the sort direction.
removeDuplicates
- if set to true [remove duplicates].
List<string> ToList(this Array array, SortDirectionType sortDirectionType = None, bool removeDuplicates = False)Summary: To the list.
Parameters:
array
- The array.
sortDirectionType
- Type of the sort direction.
removeDuplicates
- if set to true [remove duplicates].
Extensions for the System.Boolean
class.
public static class BooleanExtensions
bool HasNoValue(this bool? source)Summary: Determines if the nullable boolean does not have a value.
Parameters:
source
- The nullable boolean source.Returns:
true
if the source does not have a value; otherwise,false
.
bool HasNoValueOrFalse(this bool? source)Summary: Determines if the nullable boolean does not have a value or is false.
Parameters:
source
- The nullable boolean source.Returns:
true
if the source does not have a value or is false; otherwise,false
.
bool HasNoValueOrTrue(this bool? source)Summary: Determines if the nullable boolean does not have a value or is true.
Parameters:
source
- The nullable boolean source.Returns:
true
if the source does not have a value or is true; otherwise,false
.
bool HasValueAndFalse(this bool? source)Summary: Determines if the nullable boolean has a value and it is false.
Parameters:
source
- The nullable boolean source.Returns:
true
if the source has a value and it is false; otherwise,false
.
bool HasValueAndTrue(this bool? source)Summary: Determines if the nullable boolean has a value and it is true.
Parameters:
source
- The nullable boolean source.Returns:
true
if the source has a value and it is true; otherwise,false
.
bool IsEqual(this bool? a, bool? b)Summary: Determines whether the specified nullable booleans are equal.
Parameters:
a
- The first nullable boolean.
b
- The second nullable boolean.Returns:
true
if both nullable booleans are equal; otherwise,false
.
int ToInt(this bool source)Summary: Converts the boolean to an integer.
Parameters:
source
- The boolean source.Returns: 1 if the source is true; otherwise, 0.
int ToInt(this bool? source)Summary: Converts the boolean to an integer.
Parameters:
source
- The boolean source.Returns: 1 if the source is true; otherwise, 0.
string ToYesNoString(this bool source)Summary: Converts the boolean to a "Yes" or "No" string.
Parameters:
source
- The boolean source.Returns: "Yes" if the source is true; otherwise, "No".
YesNoType ToYesNoType(this bool source)Summary: Converts the boolean to a
Atc.YesNoType
.Parameters:
source
- The boolean source.Returns:
Atc.YesNoType.Yes
if the source is true; otherwise,Atc.YesNoType.No
.
YesNoType ToYesNoType(this bool? source)Summary: Converts the boolean to a
Atc.YesNoType
.Parameters:
source
- The boolean source.Returns:
Atc.YesNoType.Yes
if the source is true; otherwise,Atc.YesNoType.No
.
Extensions for the byte class.
public static class ByteExtensions
IEnumerable<byte[]> Split(this IEnumerable<byte> source, byte splitByte)Summary: Splits a byte array by a specific byte into multiple byte arrays.
Parameters:
source
- The source byte array to split.
splitByte
- The byte to split on.
byte[] TakeBytes(this byte[] value, int startPosition = 0, int length = 0)Summary: Take some bytes from a given start position and for the given length.
Parameters:
value
- The value.
startPosition
- The start position.
length
- The length.
int TakeBytesAndConvertToInt(this byte[] value, int startPosition = 0, int length = 0)Summary: Take some bytes from a given start position and for the given length and convert to Int. and convert to a
System.Int32
value.Parameters:
value
- The value.
startPosition
- The start position.
length
- The length.
long TakeBytesAndConvertToLong(this byte[] value, int startPosition = 0, int length = 0)Summary: Take some bytes from a given start position and for the given length and convert to Long. and convert to a
System.Int64
value.Parameters:
value
- The value.
startPosition
- The start position.
length
- The length.
byte[] TakeRemainingBytes(this byte[] value, int startPosition = 0)Summary: Take the remaining bytes from a given start position.
Parameters:
value
- The value.
startPosition
- The start position.
string ToHex(this byte[] value, string separator = null, bool showHexSign = False)Summary: Converts a byte array to its hexadecimal string representation. Examples:
{ 0x1A, 0x2B, 0x3C }.ToHex() // Gives: "1A2B3C"
{ 0x1A, 0x2B, 0x3C }.ToHex("-") // Gives: "1A-2B-3C"
{ 0x1A, 0x2B, 0x3C }.ToHex("-", true) // Gives: "0x1A-0x2B-0x3C"
{ 0x1A, 0x2B, 0x3C }.ToHex(", ", true) // Gives: "0x1A, 0x2B, 0x3C"
Parameters:
value
- The byte array to be converted.
separator
- An optional character used to separate the hexadecimal values. If not provided, there will be no separator between values.
showHexSign
- A flag indicating whether to prepend each hexadecimal value with '0x'. Defaults to false.Returns: A string representation of the byte array in hexadecimal format.
Code example:
Here are several examples of using the ToHex method: byte[] exampleBytes = { 0x1A, 0x2B, 0x3C }; // Example without separator Console.WriteLine(exampleBytes.ToHex()); // Outputs: 1A2B3C // Example with separator Console.WriteLine(exampleBytes.ToHex("-")); // Outputs: 1A-2B-3C // Example with separator and hex sign Console.WriteLine(exampleBytes.ToHex("-", true)); // Outputs: 0x1A-0x2B-0x3C // Example with separator and hex sign - Note: Same as exampleBytes.ToHexWithPrefix() Console.WriteLine(exampleBytes.ToHex(", ", true)); // Outputs: 0x1A, 0x2B, 0x3C
string ToHexWithPrefix(this byte[] value)Summary: Converts a byte array to its hexadecimal string representation with a '0x' prefix for each byte and separated with ', '. Examples:
{ 0x1A, 0x2B, 0x3C }.ToHexWithPrefix() // Gives: "0x1A, 0x2B, 0x3C"
Parameters:
value
- The byte array to be converted.Returns: A string representation of the byte array in hexadecimal format, prefixed with '0x' for each byte and separated with ', '.
Code example:
byte[] exampleBytes = { 0x1A, 0x2B, 0x3C }; string hex = ToHexWithPrefix(exampleBytes); Console.WriteLine(hex); // Outputs: 0x1A, 0x2B, 0x3C
public static class ByteSizeExtensions
ByteSize Bytes(this decimal value)Summary: Returns an instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.Parameters:
value
- The size in bytes.Returns: An instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.
ByteSize Bytes(this double value)Summary: Returns an instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.Parameters:
value
- The size in bytes.Returns: An instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.
ByteSize Bytes(this float value)Summary: Returns an instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.Parameters:
value
- The size in bytes.Returns: An instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.
ByteSize Bytes(this int value)Summary: Returns an instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.Parameters:
value
- The size in bytes.Returns: An instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.
ByteSize Bytes(this uint value)Summary: Returns an instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.Parameters:
value
- The size in bytes.Returns: An instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.
ByteSize Bytes(this long value)Summary: Returns an instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.Parameters:
value
- The size in bytes.Returns: An instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.
ByteSize Bytes(this ulong value)Summary: Returns an instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.Parameters:
value
- The size in bytes.Returns: An instance of
Atc.Units.DigitalInformation.ByteSize
that represents the specified size.
The exception that is thrown when an certificate is not valid.
public class CertificateValidationException : Exception, ISerializable
public static class CharExtensions
bool IsAscii(this char value)
The exception that is thrown when a TCP error occurred.
public class ConfigurationException : Exception, ISerializable
Extensions for the System.DateTime
class.
public static class DateTimeExtensions
double DateTimeDiff(this DateTime startDate, DateTime endDate, DateTimeDiffCompareType howToCompare)Summary: Find the diff between to DateTimes.
Parameters:
startDate
- The start date.
endDate
- The end date.
howToCompare
- The how to compare.Returns: The number between start date and end date, depend on the DiffCompareType.
string GetPrettyTimeDiff(this DateTime startDate, int decimalPrecision = 3)Summary: Gets the pretty time difference.
Parameters:
startDate
- The start date.
decimalPrecision
- The decimal precision.
string GetPrettyTimeDiff(this DateTime startDate, DateTime endDate, int decimalPrecision = 3)Summary: Gets the pretty time difference.
Parameters:
startDate
- The start date.
decimalPrecision
- The decimal precision.
int GetWeekNumber(this DateTime date)Summary: Gets the week number from a given date.
Parameters:
date
- The date.Returns: The week number from the given date.
bool IsBetween(this DateTime date, DateTime startDate, DateTime endDate)Summary: Returns true if the date is between or equal to one of the two values.
Parameters:
date
- DateTime Base, from where the calculation will be preformed.
startDate
- Start date to check for.
endDate
- End date to check for.Returns: boolean value indicating if the date is between or equal to one of the two values.
string ToIso8601Date(this DateTime dateTime)Summary: To the iso8601 date.
Parameters:
dateTime
- The date time.Code example:
string isoDate = DateTime.UtcNow.ToIso8601Date();
string ToIso8601UtcDate(this DateTime dateTime)Summary: To the iso8601 UTC date.
Parameters:
dateTime
- The date time.
string ToLongDateString(this DateTime dateTime, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the long date pattern of the provided DateTimeFormatInfo.
Parameters:
dateTime
- The DateTime to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the long date pattern of the provided DateTimeFormatInfo.
string ToLongDateStringUsingCurrentUiCulture(this DateTime dateTime)Summary: Converts a DateTime to a string using the long date pattern of the current UI culture.
Parameters:
dateTime
- The DateTime to format.Returns: A string representation of the DateTime using the long date pattern of the current UI culture.
string ToLongDateStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)
string ToLongTimeString(this DateTime dateTime, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the long time pattern of the provided DateTimeFormatInfo.
Parameters:
dateTime
- The DateTime to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the long time pattern of the provided DateTimeFormatInfo.
string ToLongTimeStringUsingCurrentUiCulture(this DateTime dateTime)Summary: Converts a DateTime to a string using the long time pattern of the current UI culture.
Parameters:
dateTime
- The DateTime to format.Returns: A string representation of the DateTime using the long time pattern of the current UI culture.
string ToLongTimeStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)
string ToShortDateString(this DateTime dateTime, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the short date pattern of the provided DateTimeFormatInfo.
Parameters:
dateTime
- The DateTime to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the short date pattern of the provided DateTimeFormatInfo.
string ToShortDateStringUsingCurrentUiCulture(this DateTime dateTime)Summary: Converts a DateTime to a string using the short date pattern of the current UI culture.
Parameters:
dateTime
- The DateTime to format.Returns: A string representation of the DateTime using the short date pattern of the current UI culture.
string ToShortDateStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)
string ToShortTimeString(this DateTime dateTime, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the short time pattern of the provided DateTimeFormatInfo.
Parameters:
dateTime
- The DateTime to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the short time pattern of the provided DateTimeFormatInfo.
string ToShortTimeStringUsingCurrentUiCulture(this DateTime dateTime)Summary: Converts a DateTime to a string using the short time pattern of the current UI culture.
Parameters:
dateTime
- The DateTime to format.Returns: A string representation of the DateTime using the short time pattern of the current UI culture.
string ToShortTimeStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)
Extensions for the System.DateTimeOffset
class.
public static class DateTimeOffsetExtensions
double DateTimeDiff(this DateTimeOffset startDate, DateTimeOffset endDate, DateTimeDiffCompareType howToCompare)Summary: Find the diff between to DateTimes.
Parameters:
startDate
- The start date.
endDate
- The end date.
howToCompare
- The how to compare.Returns: The number between start date and end date, depend on the DiffCompareType.
string GetPrettyTimeDiff(this DateTimeOffset startDate, int decimalPrecision = 3)Summary: Gets the pretty time difference.
Parameters:
startDate
- The start date.
decimalPrecision
- The decimal precision.
string GetPrettyTimeDiff(this DateTimeOffset startDate, DateTimeOffset endDate, int decimalPrecision = 3)Summary: Gets the pretty time difference.
Parameters:
startDate
- The start date.
decimalPrecision
- The decimal precision.
int GetWeekNumber(this DateTimeOffset date)Summary: Gets the week number from a given date.
Parameters:
date
- The date.Returns: The week number from the given date.
bool IsBetween(this DateTimeOffset dateTimeOffset, DateTimeOffset startDate, DateTimeOffset endDate)Summary: Returns true if the date time offset is between or equal to one of the two values.
Parameters:
dateTimeOffset
- DateTime Base, from where the calculation will be preformed.
startDate
- Start date to check for.
endDate
- End date to check for.Returns: boolean value indicating if the date is between or equal to one of the two values.
DateTimeOffset ResetToStartOfCurrentHour(this DateTimeOffset dateTimeOffset)Summary: Resets to start of current hour.
Parameters:
dateTimeOffset
- The date time offset.Returns: The dateTimeOffset with the seconds and milliseconds as 0.
DateTimeOffset SetHourAndMinutes(this DateTimeOffset dateTimeOffset, int hour, int minutes)Summary: Sets the hour and minutes.
Parameters:
dateTimeOffset
- The date time offset.
hour
- The hour.
minutes
- The minutes.Returns: The dateTimeOffset with the specified hour and minutes.
string ToIso8601Date(this DateTimeOffset dateTimeOffset)Summary: To the iso8601 date.
Parameters:
dateTimeOffset
- The date time offset.
string ToIso8601UtcDate(this DateTimeOffset dateTimeOffset)Summary: To the iso8601 UTC date.
Parameters:
dateTimeOffset
- The date time offset.
string ToLongDateString(this DateTimeOffset dateTimeOffset, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the long date pattern of the provided DateTimeFormatInfo.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the long date pattern of the provided DateTimeFormatInfo.
string ToLongDateStringUsingCurrentUiCulture(this DateTimeOffset dateTimeOffset)Summary: Converts a DateTime to a string using the long date pattern of the current UI culture.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.Returns: A string representation of the DateTime using the long date pattern of the current UI culture.
string ToLongTimeString(this DateTimeOffset dateTimeOffset, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the long time pattern of the provided DateTimeFormatInfo.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the long time pattern of the provided DateTimeFormatInfo.
string ToLongTimeStringUsingCurrentUiCulture(this DateTimeOffset dateTimeOffset)Summary: Converts a DateTime to a string using the long time pattern of the current UI culture.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.Returns: A string representation of the DateTime using the long time pattern of the current UI culture.
string ToShortDateString(this DateTimeOffset dateTimeOffset, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the short date pattern of the provided DateTimeFormatInfo.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the short date pattern of the provided DateTimeFormatInfo.
string ToShortDateStringUsingCurrentUiCulture(this DateTimeOffset dateTimeOffset)Summary: Converts a DateTime to a string using the short date pattern of the current UI culture.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.Returns: A string representation of the DateTime using the short date pattern of the current UI culture.
string ToShortTimeString(this DateTimeOffset dateTimeOffset, DateTimeFormatInfo dateTimeFormatInfo)Summary: Converts a DateTime to a string using the short time pattern of the provided DateTimeFormatInfo.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.
dateTimeFormatInfo
- The DateTimeFormatInfo specifying the format to use.Returns: A string representation of the DateTime using the short time pattern of the provided DateTimeFormatInfo.
string ToShortTimeStringUsingCurrentUiCulture(this DateTimeOffset dateTimeOffset)Summary: Converts a DateTime to a string using the short time pattern of the current UI culture.
Parameters:
dateTimeOffset
- The DateTimeOffset to format.Returns: A string representation of the DateTime using the short time pattern of the current UI culture.
long ToUnixTime(this DateTimeOffset dateTimeOffset)Summary: Converts the DateTimeOffset to a unix time - seconds starting from 1-1-1970.
Parameters:
dateTimeOffset
- The date time offset.Returns: The long value from a DateTimeOffset.
Code usage:
long unixTime = DateTimeOffset.ToUnixTime(value);Code example:
DateTimeOffset dateTimeOffset = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); long unixTime = dateTimeOffset.ToUnixTime();
Extensions for the System.Decimal
class.
public static class DecimalExtensions
decimal CurrencyRounding(this decimal value)Summary: Currencies the rounding.
Parameters:
value
- The value.
decimal CurrencyRounding(this decimal value, int digits)Summary: Currencies the rounding.
Parameters:
value
- The value.
int CurrencyRoundingAsInteger(this decimal value)Summary: Currencies the rounding as integer.
Parameters:
value
- The value.
bool IsEqual(this decimal a, decimal b)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
bool IsEqual(this decimal? a, decimal? b)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
bool IsEqual(this decimal a, decimal b, int decimalPrecision)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
bool IsEqual(this decimal? a, decimal? b, int decimalPrecision)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
decimal RoundOff(this decimal value, int numberOfDecimals)Summary: Rounds the off.
Parameters:
value
- The value.
numberOfDecimals
- The number of decimals.
decimal RoundOff10(this decimal value)Summary: Rounds the off10.
Parameters:
value
- The value.
decimal RoundOff2(this decimal value)Summary: Rounds the off2.
Parameters:
value
- The value.
decimal RoundOffPercent(this decimal percent)Summary: Rounds the off percent.
Parameters:
percent
- The percent.
The exception that is thrown when an user is not found.
public class DesignTimeUseOnlyException : Exception, ISerializable
Extensions for the System.Double
class.
public static class DoubleExtensions
double DoubleEpsilonSummary: The double epsilon.
bool AreClose(this double value1, double value2)Summary: Ares the close.
Parameters:
value1
- The value1.
value2
- The value2.
int CountDecimalPoints(this double value)Summary: Returns the numbers of decimal points in the value.
Parameters:
value
- The value.
double CurrencyRounding(this double value)Summary: Currencies the rounding.
Parameters:
value
- The value.
double CurrencyRounding(this double value, int digits)Summary: Currencies the rounding.
Parameters:
value
- The value.
int CurrencyRoundingAsInteger(this double value)Summary: Currencies the rounding as integer.
Parameters:
value
- The value.
bool GreaterThanOrClose(this double value1, double value2)Summary: Greater the than or close.
Parameters:
value1
- The value1.
value2
- The value2.
bool IsEqual(this double a, double b)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
bool IsEqual(this double? a, double? b)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
bool IsEqual(this double a, double b, int decimalPrecision)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
bool IsEqual(this double? a, double? b, int decimalPrecision)Summary: Compare two values. Return
true
if they are equals.Parameters:
a
- The first value.
b
- The second value.Returns:
true
if the two values are equals,false
otherwise.
bool IsZero(this double value)Summary: Determines whether the specified value is zero.
Parameters:
value
- The value.
double RoundOff(this double value, int numberOfDecimals)Summary: Rounds the off.
Parameters:
value
- The value.
numberOfDecimals
- The number of decimals.
double RoundOff10(this double value)Summary: Rounds the off10.
Parameters:
value
- The value.
double RoundOff2(this double value)Summary: Rounds the off2.
Parameters:
value
- The value.
double RoundOffPercent(this double percent)Summary: Rounds the off percent.
Parameters:
percent
- The percent.
The exception that is thrown when an entity is not stored.
public class EntityStoreException : Exception, ISerializable
Provides extension methods for atc enum types.
public static class EnumAtcExtensions
ArrowDirectionType Opposite(this ArrowDirectionType arrowDirectionType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
CardinalDirectionType Opposite(this CardinalDirectionType cardinalDirectionType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
ForwardReverseType Opposite(this ForwardReverseType forwardReverseType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
InsertRemoveType Opposite(this InsertRemoveType insertRemoveType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
LeftRightType Opposite(this LeftRightType leftRightType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
LeftTopRightBottomType Opposite(this LeftTopRightBottomType leftTopRightBottomType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
LeftUpRightDownType Opposite(this LeftUpRightDownType leftUpRightDownType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
OnOffType Opposite(this OnOffType onOffType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
SortDirectionType Opposite(this SortDirectionType sortDirectionType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
UpDownType Opposite(this UpDownType upDownType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
YesNoType Opposite(this YesNoType yesNoType)Summary: Gets the opposite direction of the specified ArrowDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to find the opposite for.Returns: The opposite ArrowDirectionType. Returns ArrowDirectionType.None if no opposite is defined.
ArrowDirectionType ToArrowDirectionType(this CardinalDirectionType cardinalDirectionType)Summary: Converts a CardinalDirectionType to an ArrowDirectionType.
Parameters:
cardinalDirectionType
- The CardinalDirectionType to convert.Returns: ArrowDirectionType corresponding to the given CardinalDirectionType: - West is converted to ArrowDirectionType.Left - North is converted to ArrowDirectionType.Up - East is converted to ArrowDirectionType.Right - South is converted to ArrowDirectionType.Down - If no match, then default is ArrowDirectionType.None.
ArrowDirectionType ToArrowDirectionType(this LeftTopRightBottomType leftTopRightBottomType)Summary: Converts a CardinalDirectionType to an ArrowDirectionType.
Parameters:
cardinalDirectionType
- The CardinalDirectionType to convert.Returns: ArrowDirectionType corresponding to the given CardinalDirectionType: - West is converted to ArrowDirectionType.Left - North is converted to ArrowDirectionType.Up - East is converted to ArrowDirectionType.Right - South is converted to ArrowDirectionType.Down - If no match, then default is ArrowDirectionType.None.
ArrowDirectionType ToArrowDirectionType(this LeftUpRightDownType leftUpRightDownType)Summary: Converts a CardinalDirectionType to an ArrowDirectionType.
Parameters:
cardinalDirectionType
- The CardinalDirectionType to convert.Returns: ArrowDirectionType corresponding to the given CardinalDirectionType: - West is converted to ArrowDirectionType.Left - North is converted to ArrowDirectionType.Up - East is converted to ArrowDirectionType.Right - South is converted to ArrowDirectionType.Down - If no match, then default is ArrowDirectionType.None.
CardinalDirectionType ToCardinalDirectionType(this ArrowDirectionType arrowDirectionType)Summary: Converts a ArrowDirectionType to an CardinalDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: CardinalDirectionType corresponding to the given ArrowDirectionType: - Left is converted to CardinalDirectionType.West - Up is converted to CardinalDirectionType.North - Right is converted to CardinalDirectionType.East - Down is converted to CardinalDirectionType.South - If no match, then default is CardinalDirectionType.None
CardinalDirectionType ToCardinalDirectionType(this LeftTopRightBottomType leftTopRightBottomType)Summary: Converts a ArrowDirectionType to an CardinalDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: CardinalDirectionType corresponding to the given ArrowDirectionType: - Left is converted to CardinalDirectionType.West - Up is converted to CardinalDirectionType.North - Right is converted to CardinalDirectionType.East - Down is converted to CardinalDirectionType.South - If no match, then default is CardinalDirectionType.None
CardinalDirectionType ToCardinalDirectionType(this LeftUpRightDownType leftUpRightDownType)Summary: Converts a ArrowDirectionType to an CardinalDirectionType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: CardinalDirectionType corresponding to the given ArrowDirectionType: - Left is converted to CardinalDirectionType.West - Up is converted to CardinalDirectionType.North - Right is converted to CardinalDirectionType.East - Down is converted to CardinalDirectionType.South - If no match, then default is CardinalDirectionType.None
LeftTopRightBottomType ToLeftTopRightBottomType(this ArrowDirectionType arrowDirectionType)Summary: Converts a ArrowDirectionType to an LeftTopRightBottomType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftTopRightBottomType corresponding to the given ArrowDirectionType: - Left is converted to LeftTopRightBottomType.Left - Up is converted to LeftTopRightBottomType.Top - Right is converted to LeftTopRightBottomType.Right - Down is converted to LeftTopRightBottomType.Bottom - If no match, then default is LeftTopRightBottomType.None
LeftTopRightBottomType ToLeftTopRightBottomType(this CardinalDirectionType cardinalDirectionType)Summary: Converts a ArrowDirectionType to an LeftTopRightBottomType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftTopRightBottomType corresponding to the given ArrowDirectionType: - Left is converted to LeftTopRightBottomType.Left - Up is converted to LeftTopRightBottomType.Top - Right is converted to LeftTopRightBottomType.Right - Down is converted to LeftTopRightBottomType.Bottom - If no match, then default is LeftTopRightBottomType.None
LeftTopRightBottomType ToLeftTopRightBottomType(this LeftRightType leftRightType)Summary: Converts a ArrowDirectionType to an LeftTopRightBottomType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftTopRightBottomType corresponding to the given ArrowDirectionType: - Left is converted to LeftTopRightBottomType.Left - Up is converted to LeftTopRightBottomType.Top - Right is converted to LeftTopRightBottomType.Right - Down is converted to LeftTopRightBottomType.Bottom - If no match, then default is LeftTopRightBottomType.None
LeftTopRightBottomType ToLeftTopRightBottomType(this LeftUpRightDownType leftUpRightDownType)Summary: Converts a ArrowDirectionType to an LeftTopRightBottomType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftTopRightBottomType corresponding to the given ArrowDirectionType: - Left is converted to LeftTopRightBottomType.Left - Up is converted to LeftTopRightBottomType.Top - Right is converted to LeftTopRightBottomType.Right - Down is converted to LeftTopRightBottomType.Bottom - If no match, then default is LeftTopRightBottomType.None
LeftTopRightBottomType ToLeftTopRightBottomType(this UpDownType upDownType)Summary: Converts a ArrowDirectionType to an LeftTopRightBottomType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftTopRightBottomType corresponding to the given ArrowDirectionType: - Left is converted to LeftTopRightBottomType.Left - Up is converted to LeftTopRightBottomType.Top - Right is converted to LeftTopRightBottomType.Right - Down is converted to LeftTopRightBottomType.Bottom - If no match, then default is LeftTopRightBottomType.None
LeftUpRightDownType ToLeftUpRightDownType(this ArrowDirectionType arrowDirectionType)Summary: Converts a ArrowDirectionType to an LeftUpRightDownType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftUpRightDownType corresponding to the given ArrowDirectionType: - Left is converted to LeftUpRightDownType.Left - Up is converted to LeftUpRightDownType.Up - Right is converted to LeftUpRightDownType.Right - Down is converted to LeftUpRightDownType.Down - If no match, then default is LeftUpRightDownType.None
LeftUpRightDownType ToLeftUpRightDownType(this CardinalDirectionType cardinalDirectionType)Summary: Converts a ArrowDirectionType to an LeftUpRightDownType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftUpRightDownType corresponding to the given ArrowDirectionType: - Left is converted to LeftUpRightDownType.Left - Up is converted to LeftUpRightDownType.Up - Right is converted to LeftUpRightDownType.Right - Down is converted to LeftUpRightDownType.Down - If no match, then default is LeftUpRightDownType.None
LeftUpRightDownType ToLeftUpRightDownType(this LeftRightType leftRightType)Summary: Converts a ArrowDirectionType to an LeftUpRightDownType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftUpRightDownType corresponding to the given ArrowDirectionType: - Left is converted to LeftUpRightDownType.Left - Up is converted to LeftUpRightDownType.Up - Right is converted to LeftUpRightDownType.Right - Down is converted to LeftUpRightDownType.Down - If no match, then default is LeftUpRightDownType.None
LeftUpRightDownType ToLeftUpRightDownType(this LeftTopRightBottomType leftTopRightBottomType)Summary: Converts a ArrowDirectionType to an LeftUpRightDownType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftUpRightDownType corresponding to the given ArrowDirectionType: - Left is converted to LeftUpRightDownType.Left - Up is converted to LeftUpRightDownType.Up - Right is converted to LeftUpRightDownType.Right - Down is converted to LeftUpRightDownType.Down - If no match, then default is LeftUpRightDownType.None
LeftUpRightDownType ToLeftUpRightDownType(this UpDownType upDownType)Summary: Converts a ArrowDirectionType to an LeftUpRightDownType.
Parameters:
arrowDirectionType
- The ArrowDirectionType to convert.Returns: LeftUpRightDownType corresponding to the given ArrowDirectionType: - Left is converted to LeftUpRightDownType.Left - Up is converted to LeftUpRightDownType.Up - Right is converted to LeftUpRightDownType.Right - Down is converted to LeftUpRightDownType.Down - If no match, then default is LeftUpRightDownType.None
SortDirectionType ToSortDirectionType(this UpDownType upDownType)Summary: Converts a UpDownType to an SortDirectionType.
Parameters:
upDownType
- The UpDownType to convert.Returns: SortDirectionType corresponding to the given UpDownType: - Up is converted to SortDirectionType.Ascending - Down is converted to SortDirectionType.Descending - If no match, then default is SortDirectionType.None
UpDownType ToUpDownType(this SortDirectionType sortDirectionType)Summary: Converts a SortDirectionType to an UpDownType.
Parameters:
sortDirectionType
- The SortDirectionType to convert.Returns: UpDownType corresponding to the given SortDirectionType: - Ascending is converted to UpDownType.Up - Descending is converted to UpDownType.Down - If no match, then default is UpDownType.None
Extension methods for enumerations.
public static class EnumExtensions
bool AreFlagsSet(this Enum enumeration, Enum flags)Summary: Determines whether all specified flags of another enumeration are set in the current enumeration.
Parameters:
enumeration
- The enumeration to check for flags.
flags
- The flags to verify within the enumeration.Returns: True if all specified flags are set; otherwise, false.
Code example:
bool areFlagsSet = DayOfWeek.Monday.AreFlagsSet(DayOfWeek.Monday); Assert.True(areFlagsSet);
string GetDescription(this Enum enumeration, bool useLocalizedIfPossible = True)Summary: Gets the description from the enumeration.
Parameters:
enumeration
- The enumeration.
useLocalizedIfPossible
- true to use attribute for localized/description/display if possible, default is the name; false to just use the name.Returns: The description from the enumeration.
Code usage:
string day = value.GetDescription();Code example:
Assert.Equal("Monday", DayOfWeek.Monday.GetDescription());
string GetName(this Enum enumeration)Summary: Gets the name from the enumeration.
Parameters:
enumeration
- The enumeration.Returns: The name from the enumeration.
Code usage:
string day = value.GetName();Code example:
Assert.Equal("Monday", DayOfWeek.Monday.GetName());
bool IsSet(this Enum enumeration, Enum matchTo)Summary: Determines whether the specified enumeration match another enumeration.
Parameters:
enumeration
- The enumeration.
matchTo
- The enumeration to match.Returns: true on match; otherwise false.
Code usage:
bool match = DayOfWeek.Monday.IsSet(DayOfWeek.Monday);Code example:
Assert.True(DayOfWeek.Monday.IsSet(DayOfWeek.Monday));
string ToStringLowerCase(this Enum enumeration)Summary: Converts the named constant to in lower case.
Parameters:
enumeration
- The enum.
string ToStringUpperCase(this Enum enumeration)Summary: Converts the named constant to in upper case.
Parameters:
enumeration
- The enum.
Extension methods for the System.Exception
class.
public static class ExceptionExtensions
string Flatten(this Exception exception, string message = , bool includeStackTrace = False)Summary: Flattens the specified exception and inner exception data.
Parameters:
exception
- The exception.
message
- The message.
includeStackTrace
- if set to true include stack trace.Returns: The flatten message.
string GetLastInnerMessage(this Exception exception, bool includeExceptionName = False)Summary: Gets the last inner exception message.
Parameters:
exception
- The exception.
includeExceptionName
- if set to true [include exception name].
string GetMessage(this Exception exception, bool includeInnerMessage = False, bool includeExceptionName = False)Summary: Gets the exception message.
Parameters:
exception
- The exception.
includeInnerMessage
- if set to true [include inner message].
includeExceptionName
- if set to true [include exception name].
XDocument ToXml(this Exception exception)Summary: To the XML.
Parameters:
exception
- The exception.
Extensions for the System.Int32
class.
public static class IntegerExtensions
DateTime GetFirstDayOfWeekNumberByYear(this int year, int weekNumber)Summary: Get the date of the first day in the given year and week number.
Parameters:
year
- The year.
weekNumber
- The week number.Returns: The date of the first day in the given year and week number.
DateTime GetLastDayOfWeekNumberByYear(this int year, int weekNumber)Summary: Get the date of the last day in the given year and week number.
Parameters:
year
- The year.
weekNumber
- The week number.Returns: The date of the last day in the given year and week number.
string GetMonthNameByMonthNumber(this int month, bool pascalCased = False)Summary: Gets the month name by month number.
Parameters:
month
- The month.
pascalCased
- if set to true [pascal cased].Returns: The name of the month.
int GetNumberOfWeeksByYear(this int year)Summary: Gets the number of weeks by year.
Parameters:
year
- The year.Returns: The get number of weeks.
bool IsBinarySequence(this int number)Summary: Determines whether [is binary sequence] [the specified number].
Parameters:
number
- The number.Returns:
true
if [is binary sequence] [the specified number]; otherwise,false
.Code usage:
bool value = number.IsBinarySequence();Code example:
int number = 8; bool value = number.IsBinarySequence();
bool IsEqual(this int? a, int? b)Summary: Determines whether the specified a is equal.
Parameters:
a
- a.
b
- The b.Returns:
true
if the specified a is equal; otherwise,false
.
bool IsEven(this int number)Summary: Determines whether the specified number is even.
Parameters:
number
- The number.Returns:
true
if the specified number is even; otherwise,false
.
bool IsOdd(this int number)Summary: Determines whether the specified number is odd.
Parameters:
number
- The number.Returns:
true
if the specified number is odd; otherwise,false
.
bool IsPrime(this int number)Summary: Determines whether the specified number is prime.
Parameters:
number
- The number.Returns:
true
if the specified number is prime; otherwise,false
.
The exception that is thrown when an item is not found.
public class ItemNotFoundException : Exception, ISerializable
Extensions for the System.Int64
class.
public static class LongExtensions
DateTimeOffset FromUnixTime(this long valueInSeconds)Summary: Converts a unix time to a DateTimeOffset.
Parameters:
valueInSeconds
- A long containing the value (in seconds) to convert.Returns: The DateTimeOffset value from a long in seconds.
Code usage:
DateTimeOffset dateTimeOffset = value.FromUnixTime(value);Code example:
long unixTime = 0; // Equivalent to 1-1-1970 DateTimeOffset dateTimeOffset = unixTime.FromUnixTime();
DateTimeOffset FromUnixTimeMs(this long valueInMs)Summary: Converts a unix time to a DateTimeOffset.
Parameters:
valueInMs
- A long containing the value (in ms) to convert.Returns: The DateTimeOffset value from a long in ms.
Code usage:
DateTimeOffset dateTimeOffset = value.FromUnixTimeMs(value);Code example:
long unixTime = 0; // Equivalent to 1-1-1970 DateTimeOffset dateTimeOffset = unixTime.FromUnixTimeMs();
The exception that is thrown when an value is null.
public class NullException : Exception, ISerializable
Extensions for the System.Object
class.
public static class ObjectExtensions
T Clone(this T source, CloneStrategyType strategy = Json)
object GetPropertyValue(this object source, string propertyName)
string GetTypeFullName(this object source)
string GetTypeName(this object source)
The exception that is thrown when permission is not fulfilled.
public class PermissionException : Exception, ISerializable
Extensions for the string class.
public static class StringExtensions
string Alphabetize(this string value)Summary: Sorts letters in the string alphabetically.
Parameters:
value
- The string to work on.Returns: The string sorted alphabetically.
string Base64Decode(this string base64EncodedData)Summary: Decodes the
base64EncodedData
using UTF8.Parameters:
base64EncodedData
- The Base64 encoded data.
string Base64Decode(this string base64EncodedData, Encoding encoding)Summary: Decodes the
base64EncodedData
using UTF8.Parameters:
base64EncodedData
- The Base64 encoded data.
string Base64Encode(this string value)Summary: Encodes the
value
to Base64 in UTF8.Parameters:
value
- The string value to encode
string Base64Encode(this string value, Encoding encoding)Summary: Encodes the
value
to Base64 in UTF8.Parameters:
value
- The string value to encode
string CamelCase(this string value)Summary: Gets as camel case.
Parameters:
value
- The string to work on.Returns: The string with camel-case format.
bool Contains(this string value, string containsValue, bool ignoreCaseSensitive = True)Summary: Determines whether a string contains a specified value.
Parameters:
value
- The string to work on.
containsValue
- The string to compare with.
ignoreCaseSensitive
- if set to true ignore case sensitive.Returns:
true
if input string contains a value from specified value; otherwise,false
.
bool Contains(this string value, char[] containsValues, bool ignoreCaseSensitive = True)Summary: Determines whether a string contains a specified value.
Parameters:
value
- The string to work on.
containsValue
- The string to compare with.
ignoreCaseSensitive
- if set to true ignore case sensitive.Returns:
true
if input string contains a value from specified value; otherwise,false
.
bool Contains(this string value, string[] containsValues, bool ignoreCaseSensitive = True)Summary: Determines whether a string contains a specified value.
Parameters:
value
- The string to work on.
containsValue
- The string to compare with.
ignoreCaseSensitive
- if set to true ignore case sensitive.Returns:
true
if input string contains a value from specified value; otherwise,false
.
bool ContainsTemplatePattern(this string value, TemplatePatternType templatePatternType = HardBrackets)Summary: Determines if the provided string contains specific template patterns based on the specified TemplatePatternType.
Parameters:
value
- The string to check for template patterns.
templatePatternType
- The type of template pattern to look for. Defaults to HardBrackets.Returns: True if the string contains the specified template pattern; otherwise, false.
string Cut(this string value, int maxLength, string appendValue = ...)Summary: Cuts the specified value.
Parameters:
value
- The value.
maxLength
- Length of the max.
appendValue
- The append value.Returns: The string that is cutoff by the max-length and appended with the appendValue.
string EnsureEndsWithColon(this string value)Summary: Ensures the string-value ends with a ':'.
Parameters:
value
- The value.
string EnsureEndsWithDot(this string value)Summary: Ensures the string-value ends with a '.'.
Parameters:
value
- The value.
string EnsureEnvironmentNewLines(this string value)Summary: Ensure the newline characters are the platform dependent System.Environment.Newline.
Parameters:
value
- The value.Remarks: This method transform Windows, Unix, Mac newline characters to the platform dependent System.Environment.Newline. "\r\n" (\u000D\u000A) for Windows "\n" (\u000A) for Unix "\r" (\u000D) for Mac
string EnsureFirstCharacterToLower(this string value)Summary: Ensures the first character to lower.
Parameters:
value
- The value.
string EnsureFirstCharacterToUpper(this string value)Summary: Ensures the first character to upper.
Parameters:
value
- The value.
string EnsureFirstCharacterToUpperAndPlural(this string value)Summary: Ensures the first character to upper and plural.
Parameters:
value
- The value.
string EnsureFirstCharacterToUpperAndSingular(this string value)Summary: Ensures the first character to upper and singular.
Parameters:
value
- The value.
string EnsurePlural(this string value)Summary: Ensures the plural.
Parameters:
value
- The value.
string EnsureSingular(this string value)Summary: Ensures the singular.
Parameters:
value
- The value.
int GetStringFormatParameterLiteralCount(this string value)Summary: Gets the string format parameter literal count.
Parameters:
value
- The value.
int GetStringFormatParameterNumericCount(this string value)Summary: Gets the string format parameter numeric count.
Parameters:
value
- The value.
List<string> GetStringFormatParameterTemplatePlaceholders(this string value)Summary: Gets the string format parameter template placeholders.
Parameters:
value
- The value.
IList<string> GetTemplateKeys(this string value, TemplatePatternType templatePatternType = HardBrackets, bool includeTemplatePattern = False)Summary: Extracts template keys from the provided string based on the specified TemplatePatternType.
Parameters:
value
- The string to extract template keys from.
templatePatternType
- The type of template pattern to use for extraction. Defaults to HardBrackets.
includeTemplatePattern
- Indicates whether to include the template pattern in the returned keys.Returns: A list of extracted template keys. If no keys are found, an empty list is returned.
IDictionary<string, int> GetUniqueTemplateKeysWithOccurrence(this string value, TemplatePatternType templatePatternType = HardBrackets, bool includeTemplatePattern = False)Summary: Gets unique template keys from the input string and counts their occurrences.
Parameters:
value
- The input string containing template keys.
templatePatternType
- The type of template pattern to match.
includeTemplatePattern
- Determines whether to include the template pattern itself.Returns: A dictionary where keys are unique template keys, and values are the number of times each key appears in the input string.
string GetValueBetweenLessAndGreaterThanCharsIfExist(this string value)Summary: Gets the value between less and greater than chars if exist.
Parameters:
value
- The value.
string Humanize(this string value)Summary: Humanizes (make more human-readable) an identifier-style string in either camel case or snake case. For example, CamelCase will be converted to Camel Case and Snake_Case will be converted to Snake Case.
Parameters:
value
- The identifier-style string.Returns: A
System.String
humanized.
int[] IndexersOf(this string value, string pattern, bool ignoreCaseSensitive = True, bool useEndOfPatternToMatch = False)Summary: Indexers the of.
Parameters:
value
- The value.
pattern
- The pattern.
ignoreCaseSensitive
- if set to true [ignore case sensitive].
useEndOfPatternToMatch
- if set to true [use end of pattern to match].
string JavaScriptDecode(this string javaScript, bool htmlDecode)Summary: Javas the script decode.
Parameters:
javaScript
- The java script.
htmlDecode
- if set to true [HTML decode].
string JavaScriptEncode(this string javaScript, bool htmlEncode)Summary: Javas the script encode.
Parameters:
javaScript
- The java script.
htmlEncode
- if set to true [HTML encode].
string NormalizeAccents(this string value)Summary: Normalizes the accents.
Parameters:
value
- The value.Returns: The string that is normalize for accent-letter.
string NormalizeAccents(this string value, LetterAccentType letterAccentType, bool decode, bool forLower, bool forUpper)Summary: Normalizes the accents.
Parameters:
value
- The value.Returns: The string that is normalize for accent-letter.
string NormalizePascalCase(this string value)Summary: Converts a string from camel case to a string where space is inserted before each capital letter.
Parameters:
value
- The value.Returns: The string with space inserted before each capital letter.
DateTime ParseDateFromIso8601(this string value)Summary: Parses the date from iso8601.
Parameters:
value
- The value.
string PascalCase(this string value, bool removeSeparators = False)Summary: Gets as pascal case.
Parameters:
value
- The string to work on.
removeSeparators
- If true, remove all separators.Returns: The string with pascal-case format.
string PascalCase(this string value, char[] separators, bool removeSeparators = False)Summary: Gets as pascal case.
Parameters:
value
- The string to work on.
removeSeparators
- If true, remove all separators.Returns: The string with pascal-case format.
string RemoveDataCrap(this string value)Summary: Removes the data crap.
Parameters:
value
- The string to work on.Returns: The string without non-printable character.
string RemoveEnd(this string value, string endValue, bool ignoreCaseSensitive = True)Summary: Remove a specified string from the string if occure in the end of the string.
Parameters:
value
- The string to work on.
endValue
- The string to compare with.
ignoreCaseSensitive
- if set to true ignore case sensitive.Returns: The string that remains after a specified string are removed from the end of the current string.
string RemoveEndingSlashIfExist(this string value)Summary: Removes the ending slash if exist.
Parameters:
value
- The value.
string RemoveNewLines(this string value)Summary: Remove the newline characters with the string.Empty.
Parameters:
value
- The value.Remarks: This method don't use the platform dependent System.Environment.Newline but instead works for all platforms as Windows, Unix and Mac. "\r\n" (\u000D\u000A) for Windows "\n" (\u000A) for Unix "\r" (\u000D) for Mac
string RemoveNonPrintableCharacter(this string value)Summary: Removes the non-printable character.
Parameters:
value
- The string to work on.Returns: The string without non-printable character.
string RemoveStart(this string value, string startValue, bool ignoreCaseSensitive = True)Summary: Remove a specified string from the string if occurs in the start of the string.
Parameters:
value
- The string to work on.
startValue
- The string to compare with.
ignoreCaseSensitive
- if set to true ignore case sensitive.Returns: The string that remains after a specified string are removed from the start of the current string.
string ReplaceAt(this string value, int index, char newChar)Summary: Replaces at.
Parameters:
value
- The value.
index
- The index.
newChar
- The new character.
string ReplaceMany(this string value, IDictionary<string, string> replacements)Summary: Returns a new string in which all occurrences of specified strings are replaced by other specified strings.
Parameters:
value
- The string to filter.
replacements
- The replacements definition.Returns: The filtered string.
string ReplaceMany(this string value, char[] chars, char replacement)Summary: Returns a new string in which all occurrences of specified strings are replaced by other specified strings.
Parameters:
value
- The string to filter.
replacements
- The replacements definition.Returns: The filtered string.
string ReplaceNewLines(this string value, string newValue)Summary: Replace the newline characters with the newValue.
Parameters:
value
- The value.
newValue
- The new value for NewLine.Remarks: This method don't use the platform dependent System.Environment.Newline but instead works for all platforms as Windows, Unix and Mac. "\r\n" (\u000D\u000A) for Windows "\n" (\u000A) for Unix "\r" (\u000D) for Mac
string ReplaceTemplateKeyWithValue(this string value, string templateKey, string templateValue, TemplatePatternType templatePatternType = HardBrackets)Summary: Replaces a template key in the input string with a specified template value based on the given template pattern type.
Parameters:
value
- The input string containing template keys.
templateKey
- The template key to be replaced.
templateValue
- The value to replace the template key with.
templatePatternType
- The type of template pattern to match in the input string.Returns: The modified input string with the template key replaced by the template value.
string ReplaceTemplateKeysWithValues(this string value, IDictionary<string, string> templateKeyValues, TemplatePatternType templatePatternType = HardBrackets)Summary: Replaces multiple template keys in the input string with their corresponding template values based on the given template pattern type and a dictionary of key-value pairs.
Parameters:
value
- The input string containing template keys.
templateKeyValues
- A dictionary of key-value pairs where keys are template keys and values are the replacements for those keys.
templatePatternType
- The type of template pattern to match in the input string.Returns: The modified input string with template keys replaced by their corresponding template values.
string SetStringFormatParameterTemplatePlaceholders(this string value, Dictionary<string, string> replacements)Summary: Sets the string format parameter template placeholders.
Parameters:
value
- The value.
replacements
- The replacements.
string[] ToLines(this string value)Summary: Splits the specified text into r, n or rn separated lines.
Parameters:
value
- The value.Returns: An array whose elements contain the substrings from this instance that are delimited by one or more characters in separator.
Stream ToStream(this string value)Summary: Converts to stream.
Parameters:
value
- The value.
Stream ToStreamFromBase64(this string base64Data)Summary: Converts to stream from base64.
Parameters:
base64Data
- The base64 data.
string TrimExtended(this string value)Summary: TrimExtended removes all leading and trailing white-space. and multi-space characters from the current System.String object.
Parameters:
value
- The value.Returns: The string that remains after all white-space characters. are removed from the start and end and multi-space characters of the current string. If no characters can be trimmed from the current instance, the method returns the current instance unchanged.
string TrimSpecial(this string value)Summary: TrimSpecial removes some doubles chars and none readable chars.
Parameters:
value
- The string to work on.Returns: The string without none readable chars etc.
string Truncate(this string value, int maxLength, string appendValue = ...)Summary: Truncates the specified maximum length.
Parameters:
value
- The value.
maxLength
- The maximum length.
appendValue
- The append value.
bool TryParseDate(this string value, out DateTime dateTime)Summary: Tries the parse date.
Parameters:
value
- The value.
dateTime
- The date time.
bool TryParseDate(this string value, out DateTime dateTime, CultureInfo cultureInfo, DateTimeStyles dateTimeStyles = None)Summary: Tries the parse date.
Parameters:
value
- The value.
dateTime
- The date time.
bool TryParseDateFromIso8601(this string value, out DateTime dateTime)Summary: Tries the parse date from iso8601.
Parameters:
value
- The value.
dateTime
- The date time.
bool TryParseToHttpStatusCode(this string value, out HttpStatusCode httpStatusCode)
int WordCount(this string value)Summary: Words count.
Parameters:
value
- The string to work on.Returns: The count of words in the string.
string XmlDecode(this string xml)Summary: XMLs the decode.
Parameters:
xml
- The XML.
string XmlEncode(this string xml)Summary: XMLs the encode.
Parameters:
xml
- The XML.
StringHasIsExtensions.
public static class StringHasIsExtensions
bool HasHtmlTags(this string value)Summary: Determines whether [has HTML tags] [the specified value].
Parameters:
value
- The value.Returns:
true
if [has HTML tags] [the specified value]; otherwise,false
.
bool IsAlphaNumericOnly(this string value)Summary: Determines whether the specified value is alpha-numeric [a- z, A-Z, 0-9].
Parameters:
value
- The string to work on.Returns:
true
if the specified value is alpha-numeric [a- z, A-Z, 0-9]; otherwise,false
.
bool IsAlphaOnly(this string value)Summary: Determines whether the specified value is alpha [a-zA-Z].
Parameters:
value
- The string to work on.Returns:
true
if the specified value is alpha [a-zA-Z]; otherwise,false
.
bool IsCasingStyleValid(this string value, CasingStyle casingStyle)Summary: Determines whether [is casing style valid] [the specified casing style].
Parameters:
value
- The value.
casingStyle
- The casing style.Returns:
true
if [is casing style valid] [the specified casing style]; otherwise,false
.
bool IsCompanyCvrNumber(this string cvrNumber)Summary: Determines whether the specified company CVR number is a valid number.
Parameters:
cvrNumber
- The CVR number.Returns:
true
if the specified company CVR number is a valid number; otherwise,false
.Remarks: This works only for Danish companies.
bool IsCompanyPNumber(this string pNumber)Summary: Determines whether the specified company P number is a valid number.
Parameters:
pNumber
- The p number.Returns:
true
if the specified company P number is a valid number; otherwise,false
.
bool IsDate(this string value)Summary: Determines whether the specified value is a date.
Parameters:
value
- The string to work on.Returns:
true
if the specified value is a date; otherwise,false
.
bool IsDate(this string value, CultureInfo cultureInfo)Summary: Determines whether the specified value is a date.
Parameters:
value
- The string to work on.Returns:
true
if the specified value is a date; otherwise,false
.
bool IsDigitOnly(this string value)Summary: Determines whether the specified value is digit [0-9].
Parameters:
value
- The string to work on.Returns:
true
if the specified value is digit [0-9]; otherwise,false
.
bool IsEmailAddress(this string value)Summary: Determines whether the specified value is a valid email address.
Parameters:
value
- The string to work on.Returns:
true
if the specified value is a valid email address; otherwise,false
.
bool IsEqual(this string a, string b, StringComparison comparison = Ordinal, bool treatNullAsEmpty = True, bool useNormalizeAccents = False)Summary: Determines whether the specified b is equal.
Parameters:
a
- a.
b
- The b.
comparison
- The string comparison - default is 'Ordinal'.
treatNullAsEmpty
- if set to true [treat null as empty].
useNormalizeAccents
- if set to true [use normalize accents].Returns:
true
if the specified b is equal; otherwise,false
.
bool IsFalse(this string value)Summary: Determines whether the specified value is false.
Parameters:
value
- The value.
bool IsFirstCharacterLowerCase(this string value)Summary: Determines whether [is first character lower case].
Parameters:
value
- The value.Returns:
true
if [is first character lower case] [the specified value]; otherwise,false
.
bool IsFirstCharacterUpperCase(this string value)Summary: Determines whether [is first character upper case].
Parameters:
value
- The value.Returns:
true
if [is first character upper case] [the specified value]; otherwise,false
.
bool IsFormatJson(this string value)Summary: Determines whether [is format json].
Parameters:
value
- The value.Returns:
true
if [is format json] [the specified value]; otherwise,false
.
bool IsFormatXml(this string value)Summary: Determines whether [is format XML].
Parameters:
value
- The value.Returns:
true
if [is format XML] [the specified value]; otherwise,false
.
bool IsGuid(this string value)Summary: Determines whether the specified string is a System.Guid.
Parameters:
value
- The string to work on.Returns:
true
if the specified string is a System.Guid; otherwise,false
.
bool IsGuid(this string value, out Guid output)Summary: Determines whether the specified string is a System.Guid.
Parameters:
value
- The string to work on.Returns:
true
if the specified string is a System.Guid; otherwise,false
.
bool IsKey(this string value)Summary: Determines whether the specified value is key.
Parameters:
value
- The value.Returns:
true
if the specified value is key; otherwise,false
.
bool IsLengthEven(this string value)Summary: Determines whether the specified string length is even.
Parameters:
value
- The string to work on.Returns:
true
if the specified string length is even; otherwise,false
.
bool IsNumericOnly(this string value)Summary: Determines whether the specified value is numeric [0-9].
Parameters:
value
- The string to work on.Returns:
true
if the specified value is numeric [0-9]; otherwise,false
.
bool IsPersonCprNumber(this string cprNumber)Summary: Determines whether the specified person CPR number is a valid number.
Parameters:
cprNumber
- The CPR number.Returns:
true
if the specified person CPR number is a valid number; otherwise,false
.
bool IsSentence(this string value)Summary: Determines whether the specified value is sentence.
Parameters:
value
- The value.Returns:
true
if the specified value is sentence; otherwise,false
.
bool IsStringFormatParametersBalanced(this string value, bool isNumeric = True)Summary: Determines whether [is string format parameters balanced] [the specified value].
Parameters:
value
- The value.
isNumeric
- if set to true [is numeric].Returns:
true
if [is string format parameters balanced] [the specified value]; otherwise,false
.
bool IsTrue(this string value)Summary: Determines whether the specified value is true.
Parameters:
value
- The value.
bool IsWord(this string value)Summary: Determines whether the specified value is word.
Parameters:
value
- The value.Returns:
true
if the specified value is word; otherwise,false
.
The exception that is thrown when an value is null or empty.
public class StringNullOrEmptyException : Exception, ISerializable
The exception.
public class SwitchCaseDefaultException : Exception, ISerializable
Extensions for the System.Threading.Tasks.Task
class.
public static class TaskExtensions
void Forget(this Task task)Summary: Marks the provided task as 'forgotten', meaning its completion is intentionally unobserved. This method is used to explicitly denote that a task's result or exception is to be ignored. It should be used with caution, primarily in fire-and-forget scenarios where task exceptions are handled separately.
Parameters:
task
- The task to be forgotten.
void StartAndWaitAllThrottled(this IEnumerable<Task> tasksToRun, int maxTasksToRunInParallel, CancellationToken cancellationToken = null)Summary: Starts the given tasks and waits for them to complete. This will run, at most, the specified number of tasks in parallel. NOTE: If one of the given tasks has already been started, an exception will be thrown.
Parameters:
tasksToRun
- The tasks to run.
maxTasksToRunInParallel
- The maximum number of tasks to run in parallel.
cancellationToken
- The cancellation token.
void StartAndWaitAllThrottled(this IEnumerable<Task> tasksToRun, int maxTasksToRunInParallel, int timeoutInMilliseconds, CancellationToken cancellationToken = null)Summary: Starts the given tasks and waits for them to complete. This will run, at most, the specified number of tasks in parallel. NOTE: If one of the given tasks has already been started, an exception will be thrown.
Parameters:
tasksToRun
- The tasks to run.
maxTasksToRunInParallel
- The maximum number of tasks to run in parallel.
cancellationToken
- The cancellation token.
The exception that is thrown when a TCP error occurred.
public class TcpException : Exception, ISerializable
Extensions for the System.TimeSpan
class.
public static class TimeSpanExtensions
string GetPrettyTime(this TimeSpan timeSpan, int decimalPrecision = 3)Summary: Gets the pretty time.
Parameters:
timeSpan
- The timeSpan.
decimalPrecision
- The decimal precision.
TimeSpan Max(this TimeSpan t1, TimeSpan t2)Summary: Maximums the specified t1.
Parameters:
t1
- The t1.
t2
- The t2.
TimeSpan Min(this TimeSpan t1, TimeSpan t2)Summary: Minimums the specified t1.
Parameters:
t1
- The t1.
t2
- The t2.
TimeSpan RemoveMilliseconds(this TimeSpan timeSpan)Summary: Removes the millisecond part of the timeSpan.
Parameters:
timeSpan
- The timeSpan.
bool SecondsNotZero(this TimeSpan timeSpan)Summary: Determines whether the seconds part of the datetime is zero.
Parameters:
timeSpan
- The timeSpan.Returns:
true
if [is seconds is zero] otherwise,false
.
Extensions for the System.Type
class.
public static class TypeExtensions
string BeautifyName(this Type type, bool useFullName = False, bool useHtmlFormat = False, bool useGenericParameterNamesAsT = False, bool useSuffixQuestionMarkForGeneric = False)Summary: Beautifies the name.
Parameters:
type
- The type.
useFullName
- if set to true [use full name].
useHtmlFormat
- if set to true [use HTML format].
useGenericParameterNamesAsT
- if set to true [use generic parameter names as t].
useSuffixQuestionMarkForGeneric
- if set to true [use suffix question mark for generic].
string BeautifyTypeName(this Type type, bool useFullName = False)Summary: Beautifies the name of the type.
Parameters:
type
- The type.
useFullName
- if set to true [use full name].
string BeautifyTypeOfName(this Type type, bool useFullName = False, bool useHtmlFormat = False)Summary: Beautifies the name of the type of.
Parameters:
type
- The type.
useFullName
- if set to true [use full name].
useHtmlFormat
- if set to true [use HTML format].
T GetAttribute(this Type type)Summary: Gets the attribute.
Parameters:
type
- The type.
IEnumerable<T> GetAttributes(this Type type)Summary: Gets the attributes.
Parameters:
type
- The type.
Type GetBaseTypeGenericArgumentType(this Type type)Summary: Gets the type of the base type generic argument.
Parameters:
type
- The type.
Type[] GetBaseTypeGenericArgumentTypes(this Type type)Summary: Gets the base type generic argument types.
Parameters:
type
- The type.
string GetNameWithoutGenericType(this Type type, bool useFullName = False)Summary: Get the name of the type without generic part.
Parameters:
type
- The type.
useFullName
- if set to true [use full name].
Type GetNonNullableType(this Type type)
MethodInfo GetPrivateDeclaredOnlyMethod(this Type type, string name)Summary: Gets the private declared only method.
Parameters:
type
- The type.
name
- The name.
MethodInfo[] GetPrivateDeclaredOnlyMethods(this Type type)Summary: Gets the private declared only methods.
Parameters:
type
- The type.
PropertyInfo[] GetPrivateDeclaredOnlyProperties(this Type type)Summary: Gets the private declared only properties.
Parameters:
type
- The type.
PropertyInfo GetPrivateDeclaredOnlyProperty(this Type type, string name)Summary: Gets the private declared only property.
Parameters:
type
- The type.
name
- The name.
MethodInfo[] GetPublicDeclaredOnlyMethods(this Type type)Summary: Gets the public declared only methods.
Parameters:
type
- The type.Remarks: Uses: BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly.
PropertyInfo[] GetPublicDeclaredOnlyProperties(this Type type)Summary: Gets the public declared only properties.
Parameters:
type
- The type.Remarks: Uses: BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly.
object GetPublicDeclaredOnlyPropertyValue(this Type type, string name)Summary: Gets the public declared only property value.
Parameters:
type
- The type.
name
- The name.
PropertyInfo[] GetPublicProperties(this Type type)Summary: Gets the public properties.
Parameters:
type
- The type.Remarks: Uses: BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static.
bool HasValidationAttributes(this Type type)Summary: Determines whether [has validation attributes].
Parameters:
type
- The type.Returns:
true
if [has validation attributes] [the specified type]; otherwise,false
.
bool IsDelegate(this Type type)Summary: Determines whether this instance is delegate.
Parameters:
type
- The type.Returns:
true
if the specified type is delegate; otherwise,false
.
bool IsInheritedFrom(this Type type, Type inheritType)Summary: Determines whether [is inherited from] [the specified inherit type].
Parameters:
type
- The type.
inheritType
- Type of the inherit.Returns:
true
if [is inherited from] [the specified inherit type]; otherwise,false
.
bool IsInheritedFromGenericWithArgumentType(this Type type, Type inheritType, Type argumentType, bool matchAlsoOnArgumentTypeInterface = True)Summary: Determines whether [is inherited from generic with argument type] [the specified inherit type].
Parameters:
type
- The type.
inheritType
- Type of the inherit.
argumentType
- Type of the argument.
matchAlsoOnArgumentTypeInterface
- if set to true [match also on argument type interface].Returns:
true
if [is inherited from generic with argument type] [the specified inherit type]; otherwise,false
.
bool IsNullable(this Type type)Summary: Determines whether this instance is nullable.
Parameters:
type
- The type.Returns:
true
if the specified type is nullable; otherwise,false
.
bool IsSimple(this Type type)Summary: Determines whether this instance is simple.
Parameters:
type
- The type.Returns:
true
if the specified type is simple; otherwise,false
.
bool IsSubClassOfRawGeneric(this Type baseType, Type derivedType)Summary: Determines whether [is sub class of raw generic] [the specified derived type].
Parameters:
baseType
- Type of the base.
derivedType
- Type of the derived.Returns:
true
if [is sub class of raw generic] [the specified derived type]; otherwise,false
.
T TryGetAttribute(this Type type)Summary: Tries the get attribute.
Parameters:
type
- The type.
bool TryGetEnumType(this Type type, out Type enumType)Summary: Try to extract the enum-type.
Parameters:
type
- The type.
enumType
- Type of the enum.
The exception that is thrown when actual type differs from expected type.
public class UnexpectedTypeException : Exception, ISerializable
The exception that is thrown when an user is not found.
public class UserNotFoundException : Exception, ISerializable
public static class VersionExtensions
int CompareTo(this Version version, Version otherVersion, int significantParts = 4, int startingPart = 1)Summary: Is 'version' greater than the 'otherVersion', where the significantParts is the stop part. Example significantParts=2, then only Major and Minor wil be taken into consideration.
Parameters:
version
- The version.
otherVersion
- The other version.
significantParts
- The significant parts (default is 4 which means [major.minor.build.revision] ).
startingPart
- The starting parts (default is 1 which means all 4 significant parts).Returns: -1, 0 or 1.
Code example:
- Set significantParts = 4 and startingPart 1 => [major.minor.build.revision] - Set significantParts = 4 and startingPart 2 => major.[minor.build.revision] - Set significantParts = 3 and startingPart 1 => [major.minor.build] - Set significantParts = 3 and startingPart 2 => major.[minor.build]
bool GreaterThan(this Version version, Version otherVersion, int significantParts = 4, int startingPart = 1)Summary: Is 'version' greater than the 'otherVersion'.
Parameters:
version
- The version.
otherVersion
- The other version.
significantParts
- The significant parts.
startingPart
- The starting parts.Returns:
true
if 'otherVersion' is greater than the current 'version'; otherwise,false
.
bool GreaterThanOrEqualTo(this Version version, Version otherVersion, int significantParts = 4, int startingPart = 1)Summary: Is 'version' greater than or equal to the 'otherVersion'.
Parameters:
version
- The version.
otherVersion
- The other version.
significantParts
- The significant parts.
startingPart
- The starting parts.Returns:
true
if 'otherVersion' is greater than or equal to the current 'version'; otherwise,false
.
bool IsNewerThan(this Version version, Version otherVersion, bool withinMinorReleaseOnly = False)Summary: Determines whether 'version' is newer than the 'otherVersion'.
Parameters:
version
- The version.
otherVersion
- The other version.
withinMinorReleaseOnly
- if set to true Than major has to be the same or smaller.Returns:
true
if 'otherVersion' is newer than the 'version'; otherwise,false
.Code example:
For withinMinorReleaseOnly = true: 4.8.8.0 is newer than 4.5.3.3 4.5.8.0 is newer than 4.5.3.3 4.8.3.0 is newer than 4.5.3.3 4.5.4.0 is newer than 4.5.3.3 4.5.3.0 is NOT newer than 4.5.3.3 5.8.8.0 is NOT newer than 4.5.3.3 For withinMinorReleaseOnly = false: 4.8.8.0 is newer than 4.5.3.3 4.5.8.0 is newer than 4.5.3.3 4.8.3.0 is newer than 4.5.3.3 4.5.4.0 is newer than 4.5.3.3 4.5.3.0 is NOT newer than 4.5.3.3 5.8.8.0 is newer than 4.5.3.3
The exception that is thrown when an ViewModel is not as expected.
public class ViewModelException : Exception, ISerializable