Skip to content

Latest commit

 

History

History
3285 lines (3100 loc) · 124 KB

System.md

File metadata and controls

3285 lines (3100 loc) · 124 KB

System


AppDomainExtensions

Extensions for the System.AppDomain class.

public static class AppDomainExtensions

Static Methods

GetAllExportedTypes

Type[] GetAllExportedTypes(this AppDomain appDomain)

Summary: Gets all exported types.

Parameters:
     appDomain  -  The application domain.

GetAssemblyInformations

AssemblyInformation[] GetAssemblyInformations(this AppDomain appDomain)

Summary: Gets the assembly informations.

Parameters:
     appDomain  -  The application domain.

Returns: The array of Atc.Data.Models.AssemblyInformation.

GetAssemblyInformationsByStartsWith

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.

GetAssemblyInformationsBySystem

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.

GetCustomAssemblies

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.

GetExportedPropertyTypeByName

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.

GetExportedTypeByName

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.

TryLoadAssemblyIfNeeded

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

ArgumentNullOrDefaultException.

public class ArgumentNullOrDefaultException : ArgumentException, ISerializable

ArgumentNullOrDefaultPropertyException

ArgumentNullOrDefaultPropertyException.

public class ArgumentNullOrDefaultPropertyException : ArgumentException, ISerializable

ArgumentNullPropertyException

ArgumentNullPropertyException.

public class ArgumentNullPropertyException : ArgumentException, ISerializable

ArgumentPropertyException

ArgumentPropertyException.

public class ArgumentPropertyException : ArgumentException, ISerializable

ArgumentPropertyNullException

ArgumentPropertyNullException.

public class ArgumentPropertyNullException : ArgumentException, ISerializable

ArrayExtensions

Extensions for the System.Array class.

public static class ArrayExtensions

Static Methods

RemoveDuplicates

Array RemoveDuplicates(this Array array)

Summary: Removes the duplicates.

Parameters:
     array  -  The array.

ToArray

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

ToList

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


BooleanExtensions

Extensions for the System.Boolean class.

public static class BooleanExtensions

Static Methods

HasNoValue

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.

HasNoValueOrFalse

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.

HasNoValueOrTrue

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.

HasValueAndFalse

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.

HasValueAndTrue

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.

IsEqual

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.

ToInt

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.

ToInt

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.

ToYesNoString

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

ToYesNoType

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.

ToYesNoType

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.


ByteExtensions

Extensions for the byte class.

public static class ByteExtensions

Static Methods

Split

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.

TakeBytes

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.

TakeBytesAndConvertToInt

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.

TakeBytesAndConvertToLong

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.

TakeRemainingBytes

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.

ToHex

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

ToHexWithPrefix

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

ByteSizeExtensions

public static class ByteSizeExtensions

Static Methods

Bytes

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.

Bytes

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.

Bytes

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.

Bytes

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.

Bytes

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.

Bytes

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.

Bytes

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.


CertificateValidationException

The exception that is thrown when an certificate is not valid.

public class CertificateValidationException : Exception, ISerializable

CharExtensions

public static class CharExtensions

Static Methods

IsAscii

bool IsAscii(this char value)

ConfigurationException

The exception that is thrown when a TCP error occurred.

public class ConfigurationException : Exception, ISerializable

DateTimeExtensions

Extensions for the System.DateTime class.

public static class DateTimeExtensions

Static Methods

DateTimeDiff

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.

GetPrettyTimeDiff

string GetPrettyTimeDiff(this DateTime startDate, int decimalPrecision = 3)

Summary: Gets the pretty time difference.

Parameters:
     startDate  -  The start date.
     decimalPrecision  -  The decimal precision.

GetPrettyTimeDiff

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.

GetWeekNumber

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.

IsBetween

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.

ToIso8601Date

string ToIso8601Date(this DateTime dateTime)

Summary: To the iso8601 date.

Parameters:
     dateTime  -  The date time.

Code example:

string isoDate = DateTime.UtcNow.ToIso8601Date();

ToIso8601UtcDate

string ToIso8601UtcDate(this DateTime dateTime)

Summary: To the iso8601 UTC date.

Parameters:
     dateTime  -  The date time.

ToLongDateString

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.

ToLongDateStringUsingCurrentUiCulture

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.

ToLongDateStringUsingSpecificCulture

string ToLongDateStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)

ToLongTimeString

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.

ToLongTimeStringUsingCurrentUiCulture

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.

ToLongTimeStringUsingSpecificCulture

string ToLongTimeStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)

ToShortDateString

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.

ToShortDateStringUsingCurrentUiCulture

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.

ToShortDateStringUsingSpecificCulture

string ToShortDateStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)

ToShortTimeString

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.

ToShortTimeStringUsingCurrentUiCulture

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.

ToShortTimeStringUsingSpecificCulture

string ToShortTimeStringUsingSpecificCulture(this DateTime dateTime, CultureInfo cultureInfo)

DateTimeOffsetExtensions

Extensions for the System.DateTimeOffset class.

public static class DateTimeOffsetExtensions

Static Methods

DateTimeDiff

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.

GetPrettyTimeDiff

string GetPrettyTimeDiff(this DateTimeOffset startDate, int decimalPrecision = 3)

Summary: Gets the pretty time difference.

Parameters:
     startDate  -  The start date.
     decimalPrecision  -  The decimal precision.

GetPrettyTimeDiff

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.

GetWeekNumber

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.

IsBetween

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.

ResetToStartOfCurrentHour

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.

SetHourAndMinutes

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.

ToIso8601Date

string ToIso8601Date(this DateTimeOffset dateTimeOffset)

Summary: To the iso8601 date.

Parameters:
     dateTimeOffset  -  The date time offset.

ToIso8601UtcDate

string ToIso8601UtcDate(this DateTimeOffset dateTimeOffset)

Summary: To the iso8601 UTC date.

Parameters:
     dateTimeOffset  -  The date time offset.

ToLongDateString

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.

ToLongDateStringUsingCurrentUiCulture

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.

ToLongTimeString

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.

ToLongTimeStringUsingCurrentUiCulture

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.

ToShortDateString

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.

ToShortDateStringUsingCurrentUiCulture

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.

ToShortTimeString

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.

ToShortTimeStringUsingCurrentUiCulture

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.

ToUnixTime

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();

DecimalExtensions

Extensions for the System.Decimal class.

public static class DecimalExtensions

Static Methods

CurrencyRounding

decimal CurrencyRounding(this decimal value)

Summary: Currencies the rounding.

Parameters:
     value  -  The value.

CurrencyRounding

decimal CurrencyRounding(this decimal value, int digits)

Summary: Currencies the rounding.

Parameters:
     value  -  The value.

CurrencyRoundingAsInteger

int CurrencyRoundingAsInteger(this decimal value)

Summary: Currencies the rounding as integer.

Parameters:
     value  -  The value.

IsEqual

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.

IsEqual

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.

IsEqual

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.

IsEqual

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.

RoundOff

decimal RoundOff(this decimal value, int numberOfDecimals)

Summary: Rounds the off.

Parameters:
     value  -  The value.
     numberOfDecimals  -  The number of decimals.

RoundOff10

decimal RoundOff10(this decimal value)

Summary: Rounds the off10.

Parameters:
     value  -  The value.

RoundOff2

decimal RoundOff2(this decimal value)

Summary: Rounds the off2.

Parameters:
     value  -  The value.

RoundOffPercent

decimal RoundOffPercent(this decimal percent)

Summary: Rounds the off percent.

Parameters:
     percent  -  The percent.


DesignTimeUseOnlyException

The exception that is thrown when an user is not found.

public class DesignTimeUseOnlyException : Exception, ISerializable

DoubleExtensions

Extensions for the System.Double class.

public static class DoubleExtensions

Static Fields

DoubleEpsilon

double DoubleEpsilon

Summary: The double epsilon.

Static Methods

AreClose

bool AreClose(this double value1, double value2)

Summary: Ares the close.

Parameters:
     value1  -  The value1.
     value2  -  The value2.

CountDecimalPoints

int CountDecimalPoints(this double value)

Summary: Returns the numbers of decimal points in the value.

Parameters:
     value  -  The value.

CurrencyRounding

double CurrencyRounding(this double value)

Summary: Currencies the rounding.

Parameters:
     value  -  The value.

CurrencyRounding

double CurrencyRounding(this double value, int digits)

Summary: Currencies the rounding.

Parameters:
     value  -  The value.

CurrencyRoundingAsInteger

int CurrencyRoundingAsInteger(this double value)

Summary: Currencies the rounding as integer.

Parameters:
     value  -  The value.

GreaterThanOrClose

bool GreaterThanOrClose(this double value1, double value2)

Summary: Greater the than or close.

Parameters:
     value1  -  The value1.
     value2  -  The value2.

IsEqual

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.

IsEqual

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.

IsEqual

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.

IsEqual

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.

IsZero

bool IsZero(this double value)

Summary: Determines whether the specified value is zero.

Parameters:
     value  -  The value.

RoundOff

double RoundOff(this double value, int numberOfDecimals)

Summary: Rounds the off.

Parameters:
     value  -  The value.
     numberOfDecimals  -  The number of decimals.

RoundOff10

double RoundOff10(this double value)

Summary: Rounds the off10.

Parameters:
     value  -  The value.

RoundOff2

double RoundOff2(this double value)

Summary: Rounds the off2.

Parameters:
     value  -  The value.

RoundOffPercent

double RoundOffPercent(this double percent)

Summary: Rounds the off percent.

Parameters:
     percent  -  The percent.


EntityStoreException

The exception that is thrown when an entity is not stored.

public class EntityStoreException : Exception, ISerializable

EnumAtcExtensions

Provides extension methods for atc enum types.

public static class EnumAtcExtensions

Static Methods

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

Opposite

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.

ToArrowDirectionType

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.

ToArrowDirectionType

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.

ToArrowDirectionType

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.

ToCardinalDirectionType

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

ToCardinalDirectionType

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

ToCardinalDirectionType

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

ToLeftTopRightBottomType

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

ToLeftTopRightBottomType

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

ToLeftTopRightBottomType

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

ToLeftTopRightBottomType

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

ToLeftTopRightBottomType

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

ToLeftUpRightDownType

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

ToLeftUpRightDownType

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

ToLeftUpRightDownType

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

ToLeftUpRightDownType

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

ToLeftUpRightDownType

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

ToSortDirectionType

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

ToUpDownType

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


EnumExtensions

Extension methods for enumerations.

public static class EnumExtensions

Static Methods

AreFlagsSet

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);

GetDescription

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());

GetName

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());

IsSet

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));

ToStringLowerCase

string ToStringLowerCase(this Enum enumeration)

Summary: Converts the named constant to in lower case.

Parameters:
     enumeration  -  The enum.

ToStringUpperCase

string ToStringUpperCase(this Enum enumeration)

Summary: Converts the named constant to in upper case.

Parameters:
     enumeration  -  The enum.


ExceptionExtensions

Extension methods for the System.Exception class.

public static class ExceptionExtensions

Static Methods

Flatten

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.

GetLastInnerMessage

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

GetMessage

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

ToXml

XDocument ToXml(this Exception exception)

Summary: To the XML.

Parameters:
     exception  -  The exception.


IntegerExtensions

Extensions for the System.Int32 class.

public static class IntegerExtensions

Static Methods

GetFirstDayOfWeekNumberByYear

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.

GetLastDayOfWeekNumberByYear

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.

GetMonthNameByMonthNumber

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.

GetNumberOfWeeksByYear

int GetNumberOfWeeksByYear(this int year)

Summary: Gets the number of weeks by year.

Parameters:
     year  -  The year.

Returns: The get number of weeks.

IsBinarySequence

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();

IsEqual

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.

IsEven

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.

IsOdd

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.

IsPrime

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.


ItemNotFoundException

The exception that is thrown when an item is not found.

public class ItemNotFoundException : Exception, ISerializable

LongExtensions

Extensions for the System.Int64 class.

public static class LongExtensions

Static Methods

FromUnixTime

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();

FromUnixTimeMs

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();

NullException

The exception that is thrown when an value is null.

public class NullException : Exception, ISerializable

ObjectExtensions

Extensions for the System.Object class.

public static class ObjectExtensions

Static Methods

Clone

T Clone(this T source, CloneStrategyType strategy = Json)

GetPropertyValue

object GetPropertyValue(this object source, string propertyName)

GetTypeFullName

string GetTypeFullName(this object source)

GetTypeName

string GetTypeName(this object source)

PermissionException

The exception that is thrown when permission is not fulfilled.

public class PermissionException : Exception, ISerializable

StringExtensions

Extensions for the string class.

public static class StringExtensions

Static Methods

Alphabetize

string Alphabetize(this string value)

Summary: Sorts letters in the string alphabetically.

Parameters:
     value  -  The string to work on.

Returns: The string sorted alphabetically.

Base64Decode

string Base64Decode(this string base64EncodedData)

Summary: Decodes the base64EncodedData using UTF8.

Parameters:
     base64EncodedData  -  The Base64 encoded data.

Base64Decode

string Base64Decode(this string base64EncodedData, Encoding encoding)

Summary: Decodes the base64EncodedData using UTF8.

Parameters:
     base64EncodedData  -  The Base64 encoded data.

Base64Encode

string Base64Encode(this string value)

Summary: Encodes the value to Base64 in UTF8.

Parameters:
     value  -  The string value to encode

Base64Encode

string Base64Encode(this string value, Encoding encoding)

Summary: Encodes the value to Base64 in UTF8.

Parameters:
     value  -  The string value to encode

CamelCase

string CamelCase(this string value)

Summary: Gets as camel case.

Parameters:
     value  -  The string to work on.

Returns: The string with camel-case format.

Contains

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.

Contains

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.

Contains

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.

ContainsTemplatePattern

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.

Cut

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.

EnsureEndsWithColon

string EnsureEndsWithColon(this string value)

Summary: Ensures the string-value ends with a ':'.

Parameters:
     value  -  The value.

EnsureEndsWithDot

string EnsureEndsWithDot(this string value)

Summary: Ensures the string-value ends with a '.'.

Parameters:
     value  -  The value.

EnsureEnvironmentNewLines

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

EnsureFirstCharacterToLower

string EnsureFirstCharacterToLower(this string value)

Summary: Ensures the first character to lower.

Parameters:
     value  -  The value.

EnsureFirstCharacterToUpper

string EnsureFirstCharacterToUpper(this string value)

Summary: Ensures the first character to upper.

Parameters:
     value  -  The value.

EnsureFirstCharacterToUpperAndPlural

string EnsureFirstCharacterToUpperAndPlural(this string value)

Summary: Ensures the first character to upper and plural.

Parameters:
     value  -  The value.

EnsureFirstCharacterToUpperAndSingular

string EnsureFirstCharacterToUpperAndSingular(this string value)

Summary: Ensures the first character to upper and singular.

Parameters:
     value  -  The value.

EnsurePlural

string EnsurePlural(this string value)

Summary: Ensures the plural.

Parameters:
     value  -  The value.

EnsureSingular

string EnsureSingular(this string value)

Summary: Ensures the singular.

Parameters:
     value  -  The value.

GetStringFormatParameterLiteralCount

int GetStringFormatParameterLiteralCount(this string value)

Summary: Gets the string format parameter literal count.

Parameters:
     value  -  The value.

GetStringFormatParameterNumericCount

int GetStringFormatParameterNumericCount(this string value)

Summary: Gets the string format parameter numeric count.

Parameters:
     value  -  The value.

GetStringFormatParameterTemplatePlaceholders

List<string> GetStringFormatParameterTemplatePlaceholders(this string value)

Summary: Gets the string format parameter template placeholders.

Parameters:
     value  -  The value.

GetTemplateKeys

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.

GetUniqueTemplateKeysWithOccurrence

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.

GetValueBetweenLessAndGreaterThanCharsIfExist

string GetValueBetweenLessAndGreaterThanCharsIfExist(this string value)

Summary: Gets the value between less and greater than chars if exist.

Parameters:
     value  -  The value.

Humanize

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.

IndexersOf

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

JavaScriptDecode

string JavaScriptDecode(this string javaScript, bool htmlDecode)

Summary: Javas the script decode.

Parameters:
     javaScript  -  The java script.
     htmlDecode  -  if set to true [HTML decode].

JavaScriptEncode

string JavaScriptEncode(this string javaScript, bool htmlEncode)

Summary: Javas the script encode.

Parameters:
     javaScript  -  The java script.
     htmlEncode  -  if set to true [HTML encode].

NormalizeAccents

string NormalizeAccents(this string value)

Summary: Normalizes the accents.

Parameters:
     value  -  The value.

Returns: The string that is normalize for accent-letter.

NormalizeAccents

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.

NormalizePascalCase

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.

ParseDateFromIso8601

DateTime ParseDateFromIso8601(this string value)

Summary: Parses the date from iso8601.

Parameters:
     value  -  The value.

PascalCase

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.

PascalCase

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.

RemoveDataCrap

string RemoveDataCrap(this string value)

Summary: Removes the data crap.

Parameters:
     value  -  The string to work on.

Returns: The string without non-printable character.

RemoveEnd

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.

RemoveEndingSlashIfExist

string RemoveEndingSlashIfExist(this string value)

Summary: Removes the ending slash if exist.

Parameters:
     value  -  The value.

RemoveNewLines

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

RemoveNonPrintableCharacter

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.

RemoveStart

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.

ReplaceAt

string ReplaceAt(this string value, int index, char newChar)

Summary: Replaces at.

Parameters:
     value  -  The value.
     index  -  The index.
     newChar  -  The new character.

ReplaceMany

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.

ReplaceMany

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.

ReplaceNewLines

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

ReplaceTemplateKeyWithValue

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.

ReplaceTemplateKeysWithValues

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.

SetStringFormatParameterTemplatePlaceholders

string SetStringFormatParameterTemplatePlaceholders(this string value, Dictionary<string, string> replacements)

Summary: Sets the string format parameter template placeholders.

Parameters:
     value  -  The value.
     replacements  -  The replacements.

ToLines

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.

ToStream

Stream ToStream(this string value)

Summary: Converts to stream.

Parameters:
     value  -  The value.

ToStreamFromBase64

Stream ToStreamFromBase64(this string base64Data)

Summary: Converts to stream from base64.

Parameters:
     base64Data  -  The base64 data.

TrimExtended

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.

TrimSpecial

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.

Truncate

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.

TryParseDate

bool TryParseDate(this string value, out DateTime dateTime)

Summary: Tries the parse date.

Parameters:
     value  -  The value.
     dateTime  -  The date time.

TryParseDate

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.

TryParseDateFromIso8601

bool TryParseDateFromIso8601(this string value, out DateTime dateTime)

Summary: Tries the parse date from iso8601.

Parameters:
     value  -  The value.
     dateTime  -  The date time.

TryParseToHttpStatusCode

bool TryParseToHttpStatusCode(this string value, out HttpStatusCode httpStatusCode)

WordCount

int WordCount(this string value)

Summary: Words count.

Parameters:
     value  -  The string to work on.

Returns: The count of words in the string.

XmlDecode

string XmlDecode(this string xml)

Summary: XMLs the decode.

Parameters:
     xml  -  The XML.

XmlEncode

string XmlEncode(this string xml)

Summary: XMLs the encode.

Parameters:
     xml  -  The XML.


StringHasIsExtensions

StringHasIsExtensions.

public static class StringHasIsExtensions

Static Methods

HasHtmlTags

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.

IsAlphaNumericOnly

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.

IsAlphaOnly

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.

IsCasingStyleValid

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.

IsCompanyCvrNumber

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.

IsCompanyPNumber

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.

IsDate

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.

IsDate

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.

IsDigitOnly

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.

IsEmailAddress

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.

IsEqual

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.

IsFalse

bool IsFalse(this string value)

Summary: Determines whether the specified value is false.

Parameters:
     value  -  The value.

IsFirstCharacterLowerCase

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.

IsFirstCharacterUpperCase

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.

IsFormatJson

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.

IsFormatXml

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.

IsGuid

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.

IsGuid

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.

IsKey

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.

IsLengthEven

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.

IsNumericOnly

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.

IsPersonCprNumber

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.

IsSentence

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.

IsStringFormatParametersBalanced

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.

IsTrue

bool IsTrue(this string value)

Summary: Determines whether the specified value is true.

Parameters:
     value  -  The value.

IsWord

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.


StringNullOrEmptyException

The exception that is thrown when an value is null or empty.

public class StringNullOrEmptyException : Exception, ISerializable

SwitchCaseDefaultException

The exception.

public class SwitchCaseDefaultException : Exception, ISerializable

TaskExtensions

Extensions for the System.Threading.Tasks.Task class.

public static class TaskExtensions

Static Methods

Forget

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.

StartAndWaitAllThrottled

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.

StartAndWaitAllThrottled

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.


TcpException

The exception that is thrown when a TCP error occurred.

public class TcpException : Exception, ISerializable

TimeSpanExtensions

Extensions for the System.TimeSpan class.

public static class TimeSpanExtensions

Static Methods

GetPrettyTime

string GetPrettyTime(this TimeSpan timeSpan, int decimalPrecision = 3)

Summary: Gets the pretty time.

Parameters:
     timeSpan  -  The timeSpan.
     decimalPrecision  -  The decimal precision.

Max

TimeSpan Max(this TimeSpan t1, TimeSpan t2)

Summary: Maximums the specified t1.

Parameters:
     t1  -  The t1.
     t2  -  The t2.

Min

TimeSpan Min(this TimeSpan t1, TimeSpan t2)

Summary: Minimums the specified t1.

Parameters:
     t1  -  The t1.
     t2  -  The t2.

RemoveMilliseconds

TimeSpan RemoveMilliseconds(this TimeSpan timeSpan)

Summary: Removes the millisecond part of the timeSpan.

Parameters:
     timeSpan  -  The timeSpan.

SecondsNotZero

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.


TypeExtensions

Extensions for the System.Type class.

public static class TypeExtensions

Static Methods

BeautifyName

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

BeautifyTypeName

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

BeautifyTypeOfName

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

GetAttribute

T GetAttribute(this Type type)

Summary: Gets the attribute.

Parameters:
     type  -  The type.

GetAttributes

IEnumerable<T> GetAttributes(this Type type)

Summary: Gets the attributes.

Parameters:
     type  -  The type.

GetBaseTypeGenericArgumentType

Type GetBaseTypeGenericArgumentType(this Type type)

Summary: Gets the type of the base type generic argument.

Parameters:
     type  -  The type.

GetBaseTypeGenericArgumentTypes

Type[] GetBaseTypeGenericArgumentTypes(this Type type)

Summary: Gets the base type generic argument types.

Parameters:
     type  -  The type.

GetNameWithoutGenericType

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

GetNonNullableType

Type GetNonNullableType(this Type type)

GetPrivateDeclaredOnlyMethod

MethodInfo GetPrivateDeclaredOnlyMethod(this Type type, string name)

Summary: Gets the private declared only method.

Parameters:
     type  -  The type.
     name  -  The name.

GetPrivateDeclaredOnlyMethods

MethodInfo[] GetPrivateDeclaredOnlyMethods(this Type type)

Summary: Gets the private declared only methods.

Parameters:
     type  -  The type.

GetPrivateDeclaredOnlyProperties

PropertyInfo[] GetPrivateDeclaredOnlyProperties(this Type type)

Summary: Gets the private declared only properties.

Parameters:
     type  -  The type.

GetPrivateDeclaredOnlyProperty

PropertyInfo GetPrivateDeclaredOnlyProperty(this Type type, string name)

Summary: Gets the private declared only property.

Parameters:
     type  -  The type.
     name  -  The name.

GetPublicDeclaredOnlyMethods

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.

GetPublicDeclaredOnlyProperties

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.

GetPublicDeclaredOnlyPropertyValue

object GetPublicDeclaredOnlyPropertyValue(this Type type, string name)

Summary: Gets the public declared only property value.

Parameters:
     type  -  The type.
     name  -  The name.

GetPublicProperties

PropertyInfo[] GetPublicProperties(this Type type)

Summary: Gets the public properties.

Parameters:
     type  -  The type.

Remarks: Uses: BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static.

HasValidationAttributes

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.

IsDelegate

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.

IsInheritedFrom

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.

IsInheritedFromGenericWithArgumentType

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.

IsNullable

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.

IsSimple

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.

IsSubClassOfRawGeneric

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.

TryGetAttribute

T TryGetAttribute(this Type type)

Summary: Tries the get attribute.

Parameters:
     type  -  The type.

TryGetEnumType

bool TryGetEnumType(this Type type, out Type enumType)

Summary: Try to extract the enum-type.

Parameters:
     type  -  The type.
     enumType  -  Type of the enum.


UnexpectedTypeException

The exception that is thrown when actual type differs from expected type.

public class UnexpectedTypeException : Exception, ISerializable

UserNotFoundException

The exception that is thrown when an user is not found.

public class UserNotFoundException : Exception, ISerializable

VersionExtensions

public static class VersionExtensions

Static Methods

CompareTo

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]

GreaterThan

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.

GreaterThanOrEqualTo

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.

IsNewerThan

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

ViewModelException

The exception that is thrown when an ViewModel is not as expected.

public class ViewModelException : Exception, ISerializable

Generated by MarkdownCodeDoc version 1.2