ExtensionsConvertions Class |
Namespace: Cauldron
The ExtensionsConvertions type exposes the following members.
Name | Description | |
---|---|---|
As(Object, Type) |
Converts a type using the implicit or explicit operators. If both fails it will try to
convert the value with ChangeType(Object, Type).
| |
As(Object, Type, Type) |
Converts a type using the implicit or explicit operators. If both fails it will try to
convert the value with ChangeType(Object, Type).
| |
AsT(Object) |
Performs a cast between compatible reference types. If a convertion is not possible then
null is returned. As a last resort it will use ChangeType(Object, Type).
Tries to use the implicit and explicit operators if exists when convertion with 'as'
returns null.
| |
AsReadOnlyTKey, TValue |
Converts a IDictionaryTKey, TValue to a ReadOnlyDictionaryTKey, TValue.
| |
Convert(String, Type) |
Converts a string to the type defined by targetType | |
Convert(Byte, Encodings, Encodings) |
Converts a string represented by a byte array from a encoding to another encoding
| |
Convert(String, Encodings, Encodings) |
Converts a string from a encoding to another encoding
| |
Convert(String, Type, NumberFormatInfo) |
Converts a string to the type defined by targetType | |
ConvertT(String) |
Converts a string to the type defined by T | |
ConvertT(String, NumberFormatInfo) |
Converts a string to the type defined by T | |
ConvertEscapeSequences |
Converts the readable escaped chars in a string to its equivalent char. This includes
simple-escape-sequences such as \' \" \\ \0 \a \b \f \n \r \t \v
| |
ConvertToBytes |
Converts a string from a encoding to another encoding
| |
ToArray |
Converts a IEnumerable to an array
| |
ToBase64String |
Converts a string to its equivalent string representation that is encoded with base-64 digits.
| |
ToBool |
Converts a string to bool.
This will first try to compare the string to "true" or "y" and then to "false" or "n". If both fails
then it will use TryParse(String, Boolean) to parse the string to
bool. If that also fails then the string will be compared to "1".
| |
ToByte |
Converts the value to a byte If convertion fails the value will always be 0
| |
ToBytes(Double) |
Converts the value to a byte array
| |
ToBytes(Int32) |
Converts the value to a byte array
| |
ToBytes(Int64) |
Converts the value to a byte array
| |
ToBytes(Single) |
Converts the value to a byte array
| |
ToBytes(UInt32) |
Converts the value to a byte array
| |
ToBytesAsync |
Converts a Stream to Byte array. If the stream is not
seekable, then this will use ReadToEndAsync to get the stream.
| |
ToChar |
Converts the value to a char. If convertion fails the value will always be '\0'
| |
ToDecimal(String) | ||
ToDecimal(String, NumberFormatInfo) | ||
ToDecimalUS | ||
ToDouble(Byte) |
Returns a double-precision floating point number converted from eight bytes at a
specified position in a byte array.
| |
ToDouble(String) |
Converts the string representation of a number in a specified culture-specific format to
its double-precision floating-point number equivalent. if the string content is "nan"
then a NaN is returned.
Returns 0 if target cannot be parsed.
| |
ToDouble(String, NumberFormatInfo) |
Converts the string representation of a number in a specified culture-specific format to
its double-precision floating-point number equivalent. if the string content is "nan"
then a NaN is returned.
Returns 0 if target cannot be parsed.
| |
ToDoubleUS |
Converts the string representation of a number in the en-US format to its
double-precision floating-point number equivalent. if the string content is "nan" then a
NaN is returned.
Returns 0 if target cannot be parsed.
| |
ToFloat(Byte) |
Returns a single-precision floating point number converted from four bytes at a specified
position in a byte array.
| |
ToFloat(String) |
Converts the string representation of a number in a specified style and culture-specific
format to its single-precision floating-point number equivalent. if the string content is
"nan" then a NaN is returned.
Returns 0 if target cannot be parsed.
| |
ToFloat(String, NumberFormatInfo) |
Converts the string representation of a number in a specified style and culture-specific
format to its single-precision floating-point number equivalent. if the string content is
"nan" then a NaN is returned.
Returns 0 if target cannot be parsed.
| |
ToFloatUS |
Converts the string representation of a number in a the en-US format format to its
single-precision floating-point number equivalent. if the string content is "nan" then a
NaN is returned.
Returns 0 if target cannot be parsed.
| |
ToInteger(Byte) |
Returns a 32-bit signed integer converted from four bytes at a specified position in a
byte array.
| |
ToInteger(String) | ||
ToInteger(String, NumberFormatInfo) | ||
ToIntegerUS | ||
ToLong(Byte) |
Returns a long converted from eight bytes.
| |
ToLong(Object) | ||
ToLong(String) | ||
ToLong(String, NumberFormatInfo) | ||
ToLongUS | ||
ToOrdinalDate |
Converts a DateTime to ordinal date.
An ordinal date is a calendar date typically consisting of a year and a day of year ranging between 1 and 366 (starting on January 1).
| |
ToShort(String) | ||
ToShort(String, NumberFormatInfo) | ||
ToShortUS | ||
ToString(String, Object) |
Replaces the format item in a specified string with the string representation of a
corresponding object in a specified array. This also takes into account that source can be an inline text for the TextBlock. CurrentCulture is used as IFormatProvider | |
ToString(String, IFormatProvider, Object) |
Replaces the format item in a specified string with the string representation of a
corresponding object in a specified array. This also takes into account that source can be an inline text for the TextBlock
| |
ToUInteger(String) | ||
ToUInteger(String, NumberFormatInfo) | ||
ToUIntegerUS | ||
ToULong(String) | ||
ToULong(String, NumberFormatInfo) | ||
ToULongUS | ||
ToUShort(Byte) |
Returns a 16-bit signed integer converted from four bytes at a specified position in a
byte array.
| |
ToUShort(String) | ||
ToUShort(String, NumberFormatInfo) | ||
ToUShortUS |