Class StringConverter
This utility class is designed to make System.String related conversions easier to work with.
Inheritance
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class StringConverter
Methods
| Improve this DocFromBytes(Byte[], Action<EncodingOptions>)
Converts the specified value to a string using the provided preferred encoding.
Declaration
public static string FromBytes(byte[] value, Action<EncodingOptions> setup = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | value | The byte array to be converted. |
| System.Action<EncodingOptions> | setup | The EncodingOptions which need to be configured. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String containing the results of decoding the specified sequence of bytes. |
Remarks
EncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
FromChars(IEnumerable<Char>)
Converts the specified value to its equivalent System.String representation.
Declaration
public static string FromChars(IEnumerable<char> value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Char> | value | The System.Char sequence to convert. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String equivalent to the specified |
FromException(Exception)
Renders the exception to a human readable System.String.
Declaration
public static string FromException(Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The System.Exception to render human readable. |
Returns
| Type | Description |
|---|---|
| System.String | A human readable System.String variant of the specified |
Remarks
The rendered exception defaults to using an instance of System.Text.Encoding.Unicode unless specified otherwise.
FromException(Exception, Encoding)
Renders the exception to a human readable System.String.
Declaration
public static string FromException(Exception exception, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The System.Exception to render human readable. |
| System.Text.Encoding | encoding | The encoding to use when rendering the |
Returns
| Type | Description |
|---|---|
| System.String | A human readable System.String variant of the specified |
FromException(Exception, Encoding, Boolean)
Renders the exception to a human readable System.String.
Declaration
public static string FromException(Exception exception, Encoding encoding, bool includeStackTrace)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | The System.Exception to render human readable. |
| System.Text.Encoding | encoding | The encoding to use when rendering the |
| System.Boolean | includeStackTrace | if set to |
Returns
| Type | Description |
|---|---|
| System.String | A human readable System.String variant of the specified |
FromHexadecimal(String, Action<EncodingOptions>)
Converts the specified hexadecimal hexadecimalValue to its equivalent System.String representation.
Declaration
public static string FromHexadecimal(string hexadecimalValue, Action<EncodingOptions> setup = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | hexadecimalValue | The hexadecimal string to be converted. |
| System.Action<EncodingOptions> | setup | The EncodingOptions which need to be configured. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String representation of the hexadecimal characters in |
Remarks
EncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
FromObject(Object)
Returns a System.String that represents the specified instance.
Declaration
public static string FromObject(object instance)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | instance | The instance to represent. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the specified |
Remarks
When determining the representation of the specified instance, these rules applies:
1: if the System.Object.ToString() method has been overridden, any further processing is skipped
2: any public properties having index parameters is skipped
3: any public properties is appended to the result if System.Object.ToString() has not been overridden.
Note: do not call this method from an overridden ToString(..) method as a stackoverflow exception will occur.
FromObject(Object, Boolean)
Returns a System.String that represents the specified instance.
Declaration
public static string FromObject(object instance, bool bypassOverrideCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | instance | The instance to represent. |
| System.Boolean | bypassOverrideCheck | Specify |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the specified |
Remarks
When determining the representation of the specified instance, these rules applies:
1: if the System.Object.ToString() method has been overridden, any further processing is skipped
2: any public properties having index parameters is skipped
3: any public properties is appended to the result if System.Object.ToString() has not been overridden.
Note: do not call this method from an overridden ToString(..) method without setting bypassOverrideCheck to true; otherwise a stackoverflow exception will occur.
FromObject(Object, Boolean, IFormatProvider)
Returns a System.String that represents the specified instance.
Declaration
public static string FromObject(object instance, bool bypassOverrideCheck, IFormatProvider provider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | instance | The instance to represent. |
| System.Boolean | bypassOverrideCheck | Specify |
| System.IFormatProvider | provider | An object that supplies culture-specific formatting information. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the specified |
Remarks
When determining the representation of the specified instance, these rules applies:
1: if the System.Object.ToString() method has been overridden, any further processing is skipped
2: any public properties having index parameters is skipped
3: any public properties is appended to the result if System.Object.ToString() has not been overridden.
Note: do not call this method from an overridden ToString(..) method without setting bypassOverrideCheck to true; otherwise a stackoverflow exception will occur.
FromObject(Object, Boolean, IFormatProvider, String)
Returns a System.String that represents the specified instance.
Declaration
public static string FromObject(object instance, bool bypassOverrideCheck, IFormatProvider provider, string delimiter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | instance | The instance to represent. |
| System.Boolean | bypassOverrideCheck | Specify |
| System.IFormatProvider | provider | An object that supplies culture-specific formatting information. |
| System.String | delimiter | The delimiter specification for when representing public properties of |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the specified |
Remarks
When determining the representation of the specified instance, these rules applies:
1: if the System.Object.ToString() method has been overridden, any further processing is skipped
2: any public properties having index parameters is skipped
3: any public properties is appended to the result if System.Object.ToString() has not been overridden.
Note: do not call this method from an overridden ToString(..) method without setting bypassOverrideCheck to true; otherwise a stackoverflow exception will occur.
FromObject(Object, Boolean, IFormatProvider, String, Func<PropertyInfo, Object, IFormatProvider, String>)
Returns a System.String that represents the specified instance.
Declaration
public static string FromObject(object instance, bool bypassOverrideCheck, IFormatProvider provider, string delimiter, Func<PropertyInfo, object, IFormatProvider, string> propertyConverter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | instance | The instance to represent. |
| System.Boolean | bypassOverrideCheck | Specify |
| System.IFormatProvider | provider | An object that supplies culture-specific formatting information. |
| System.String | delimiter | The delimiter specification for when representing public properties of |
| System.Func<System.Reflection.PropertyInfo, System.Object, System.IFormatProvider, System.String> | propertyConverter | The function delegate that convert System.Reflection.PropertyInfo objects to human-readable content. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the specified |
Remarks
When determining the representation of the specified instance, these rules applies:
1: if the System.Object.ToString() method has been overridden, any further processing is skipped
2: any public properties having index parameters is skipped
3: any public properties is appended to the result if System.Object.ToString() has not been overridden.
Note: do not call this method from an overridden ToString(..) method without setting bypassOverrideCheck to true; otherwise a stackoverflow exception will occur.
FromObject(Object, Boolean, IFormatProvider, String, Func<PropertyInfo, Object, IFormatProvider, String>, Func<Type, BindingFlags, IEnumerable<PropertyInfo>>, BindingFlags)
Returns a System.String that represents the specified instance.
Declaration
public static string FromObject(object instance, bool bypassOverrideCheck, IFormatProvider provider, string delimiter, Func<PropertyInfo, object, IFormatProvider, string> propertyConverter, Func<Type, BindingFlags, IEnumerable<PropertyInfo>> propertiesReader, BindingFlags propertiesReaderBindingAttr)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | instance | The instance to represent. |
| System.Boolean | bypassOverrideCheck | Specify |
| System.IFormatProvider | provider | An object that supplies culture-specific formatting information. |
| System.String | delimiter | The delimiter specification for when representing public properties of |
| System.Func<System.Reflection.PropertyInfo, System.Object, System.IFormatProvider, System.String> | propertyConverter | The function delegate that convert System.Reflection.PropertyInfo objects to human-readable content. |
| System.Func<System.Type, System.Reflection.BindingFlags, System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo>> | propertiesReader | The function delegate that read System.Reflection.PropertyInfo objects from the underlying System.Type of |
| System.Reflection.BindingFlags | propertiesReaderBindingAttr | A bitmask comprised of one or more System.Reflection.BindingFlags that specify how the search for System.Reflection.PropertyInfo objects in the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the specified |
Remarks
When determining the representation of the specified instance, these rules applies:
1: if the System.Object.ToString() method has been overridden, any further processing is skipped
2: any public properties having index parameters is skipped
3: any public properties is appended to the result if System.Object.ToString() has not been overridden.
Note: do not call this method from an overridden ToString(..) method without setting bypassOverrideCheck to true; otherwise a stackoverflow exception will occur.
FromPascalCasing(String, String)
Converts the specified pascal-case representation value to a human readable string.
Declaration
public static string FromPascalCasing(string value, string delimiter = " ")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The System.String to convert. |
| System.String | delimiter | The delimiter to use when converting PascalCasing to a human readable string. Default is space ( ). |
Returns
| Type | Description |
|---|---|
| System.String | A human readable string from the specified pascal-case representation |
FromStream(Stream, Action<EncodingOptions>)
Converts the specified value to a string using the provided preferred encoding.
Declaration
public static string FromStream(Stream value, Action<EncodingOptions> setup = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | value | The System.IO.Stream to be converted. |
| System.Action<EncodingOptions> | setup | The EncodingOptions which need to be configured. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String containing the decoded result of the specified |
Remarks
EncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
FromStream(Stream, Action<EncodingOptions>, Boolean)
Converts the specified value to a string using the provided preferred encoding.
Declaration
public static string FromStream(Stream value, Action<EncodingOptions> setup, bool leaveStreamOpen)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | value | The System.IO.Stream to be converted. |
| System.Action<EncodingOptions> | setup | The EncodingOptions which need to be configured. |
| System.Boolean | leaveStreamOpen | if |
Returns
| Type | Description |
|---|---|
| System.String | A System.String containing the decoded result of the specified |
Remarks
EncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
FromType(Type)
Converts the name of the source with the intend to be understood by humans.
Declaration
public static string FromType(Type source)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | source | The type to sanitize the name from. |
Returns
| Type | Description |
|---|---|
| System.String | A sanitized System.String representation of |
Remarks
Only the simple name of the source is returned, not the fully qualified name.
FromType(Type, Boolean)
Converts the name of the source with the intend to be understood by humans.
Declaration
public static string FromType(Type source, bool fullName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | source | The type to sanitize the name from. |
| System.Boolean | fullName | Specify |
Returns
| Type | Description |
|---|---|
| System.String | A sanitized System.String representation of |
FromType(Type, Boolean, Boolean)
Converts the name of the source with the intend to be understood by humans.
Declaration
public static string FromType(Type source, bool fullName, bool excludeGenericArguments)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | source | The type to sanitize the name from. |
| System.Boolean | fullName | Specify |
| System.Boolean | excludeGenericArguments | Specify |
Returns
| Type | Description |
|---|---|
| System.String | A sanitized System.String representation of |
FromUriScheme(UriScheme)
Converts the specified string representation of an URI scheme to its UriScheme equivalent.
Declaration
public static string FromUriScheme(UriScheme uriScheme)
Parameters
| Type | Name | Description |
|---|---|---|
| UriScheme | uriScheme | A string containing an URI scheme to convert. |
Returns
| Type | Description |
|---|---|
| System.String | An UriScheme equivalent to the specified |
ToBinary(Byte[])
Converts the specified value to its equivalent binary representation.
Declaration
public static string ToBinary(byte[] value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | value | The byte array to be converted. |
Returns
| Type | Description |
|---|---|
| System.String | A binary System.String representation of the elements in |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
ToCamelCasing(String)
Converts the specified value to a camel-case representation, using culture-independent casing rules.
Declaration
public static string ToCamelCasing(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The System.String value to convert. |
Returns
| Type | Description |
|---|---|
| System.String | A camel-case representation of the specified System.String value. |
ToDelimitedString<T>(IEnumerable<T>)
Converts the specified source to a string of comma delimited values.
Declaration
public static string ToDelimitedString<T>(IEnumerable<T> source)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<T> | source | A collection of values to be converted. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of comma delimited values. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the |
ToDelimitedString<TSource>(IEnumerable<TSource>, String)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource>(IEnumerable<TSource> source, string delimiter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A sequence of elements to be converted. |
| System.String | delimiter | The delimiter specification. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
ToDelimitedString<TSource>(IEnumerable<TSource>, String, Func<TSource, String>)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource>(IEnumerable<TSource> source, string delimiter, Func<TSource, string> converter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A sequence of elements to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.Func<TSource, System.String> | converter | The function delegate that converts |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
ToDelimitedString<TSource>(IEnumerable<TSource>, String, String)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource>(IEnumerable<TSource> source, string delimiter, string format)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A sequence of elements to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.String | format | The desired format of the converted values. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
ToDelimitedString<TSource>(IEnumerable<TSource>, String, String, Func<TSource, String>)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource>(IEnumerable<TSource> source, string delimiter, string format, Func<TSource, string> converter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A sequence of elements to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.String | format | The desired format of the converted values. |
| System.Func<TSource, System.String> | converter | The function delegate that converts |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
ToDelimitedString<TSource, T>(IEnumerable<TSource>, String, Func<TSource, T, String>, T)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T>(IEnumerable<TSource> source, string delimiter, Func<TSource, T, string> converter, T arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.Func<TSource, T, System.String> | converter | The function delegate that converts |
| T | arg | The parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T | The type of the parameter of the function delegate |
ToDelimitedString<TSource, T>(IEnumerable<TSource>, String, String, Func<TSource, T, String>, T)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T>(IEnumerable<TSource> source, string delimiter, string format, Func<TSource, T, string> converter, T arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.String | format | The desired format of the converted values. |
| System.Func<TSource, T, System.String> | converter | The function delegate that converts |
| T | arg | The parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T | The type of the parameter of the function delegate |
ToDelimitedString<TSource, T1, T2>(IEnumerable<TSource>, String, Func<TSource, T1, T2, String>, T1, T2)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2>(IEnumerable<TSource> source, string delimiter, Func<TSource, T1, T2, string> converter, T1 arg1, T2 arg2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.Func<TSource, T1, T2, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
ToDelimitedString<TSource, T1, T2>(IEnumerable<TSource>, String, String, Func<TSource, T1, T2, String>, T1, T2)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2>(IEnumerable<TSource> source, string delimiter, string format, Func<TSource, T1, T2, string> converter, T1 arg1, T2 arg2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.String | format | The desired format of the converted values. |
| System.Func<TSource, T1, T2, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
ToDelimitedString<TSource, T1, T2, T3>(IEnumerable<TSource>, String, Func<TSource, T1, T2, T3, String>, T1, T2, T3)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2, T3>(IEnumerable<TSource> source, string delimiter, Func<TSource, T1, T2, T3, string> converter, T1 arg1, T2 arg2, T3 arg3)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.Func<TSource, T1, T2, T3, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
| T3 | arg3 | The third parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
| T3 | The type of the third parameter of the function delegate |
ToDelimitedString<TSource, T1, T2, T3>(IEnumerable<TSource>, String, String, Func<TSource, T1, T2, T3, String>, T1, T2, T3)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2, T3>(IEnumerable<TSource> source, string delimiter, string format, Func<TSource, T1, T2, T3, string> converter, T1 arg1, T2 arg2, T3 arg3)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.String | format | The desired format of the converted values. |
| System.Func<TSource, T1, T2, T3, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
| T3 | arg3 | The third parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
| T3 | The type of the third parameter of the function delegate |
ToDelimitedString<TSource, T1, T2, T3, T4>(IEnumerable<TSource>, String, Func<TSource, T1, T2, T3, T4, String>, T1, T2, T3, T4)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2, T3, T4>(IEnumerable<TSource> source, string delimiter, Func<TSource, T1, T2, T3, T4, string> converter, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.Func<TSource, T1, T2, T3, T4, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
| T3 | arg3 | The third parameter of the function delegate |
| T4 | arg4 | The fourth parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
| T3 | The type of the third parameter of the function delegate |
| T4 | The type of the fourth parameter of the function delegate |
ToDelimitedString<TSource, T1, T2, T3, T4>(IEnumerable<TSource>, String, String, Func<TSource, T1, T2, T3, T4, String>, T1, T2, T3, T4)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2, T3, T4>(IEnumerable<TSource> source, string delimiter, string format, Func<TSource, T1, T2, T3, T4, string> converter, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.String | format | The desired format of the converted values. |
| System.Func<TSource, T1, T2, T3, T4, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
| T3 | arg3 | The third parameter of the function delegate |
| T4 | arg4 | The fourth parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
| T3 | The type of the third parameter of the function delegate |
| T4 | The type of the fourth parameter of the function delegate |
ToDelimitedString<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource>, String, Func<TSource, T1, T2, T3, T4, T5, String>, T1, T2, T3, T4, T5)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource> source, string delimiter, Func<TSource, T1, T2, T3, T4, T5, string> converter, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.Func<TSource, T1, T2, T3, T4, T5, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
| T3 | arg3 | The third parameter of the function delegate |
| T4 | arg4 | The fourth parameter of the function delegate |
| T5 | arg5 | The fifth parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
| T3 | The type of the third parameter of the function delegate |
| T4 | The type of the fourth parameter of the function delegate |
| T5 | The type of the fifth parameter of the function delegate |
ToDelimitedString<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource>, String, String, Func<TSource, T1, T2, T3, T4, T5, String>, T1, T2, T3, T4, T5)
Converts the specified source to a string of delimiter delimited values.
Declaration
public static string ToDelimitedString<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource> source, string delimiter, string format, Func<TSource, T1, T2, T3, T4, T5, string> converter, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<TSource> | source | A collection of values to be converted. |
| System.String | delimiter | The delimiter specification. |
| System.String | format | The desired format of the converted values. |
| System.Func<TSource, T1, T2, T3, T4, T5, System.String> | converter | The function delegate that converts |
| T1 | arg1 | The first parameter of the function delegate |
| T2 | arg2 | The second parameter of the function delegate |
| T3 | arg3 | The third parameter of the function delegate |
| T4 | arg4 | The fourth parameter of the function delegate |
| T5 | arg5 | The fifth parameter of the function delegate |
Returns
| Type | Description |
|---|---|
| System.String | A System.String of delimited values from the by parameter specified delimiter. |
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the elements of the sequence to convert. |
| T1 | The type of the first parameter of the function delegate |
| T2 | The type of the second parameter of the function delegate |
| T3 | The type of the third parameter of the function delegate |
| T4 | The type of the fourth parameter of the function delegate |
| T5 | The type of the fifth parameter of the function delegate |
ToEnumerable(IEnumerable<Char>)
Converts the specified value to its equivalent System.String sequence.
Declaration
public static IEnumerable<string> ToEnumerable(IEnumerable<char> value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Char> | value | The value to convert into a sequence. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.String> | A System.String sequence equivalent to the specified |
ToHexadecimal(Byte[])
Converts the specified value to its equivalent hexadecimal representation.
Declaration
public static string ToHexadecimal(byte[] value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | value | The byte array to be converted. |
Returns
| Type | Description |
|---|---|
| System.String | A hexadecimal System.String representation of the elements in |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
ToHexadecimal(String, Action<EncodingOptions>)
Converts the specified value to its equivalent hexadecimal representation.
Declaration
public static string ToHexadecimal(string value, Action<EncodingOptions> setup = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to be converted. |
| System.Action<EncodingOptions> | setup | The EncodingOptions which need to be configured. |
Returns
| Type | Description |
|---|---|
| System.String | A hexadecimal System.String representation of the characters in |
Remarks
EncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
ToMorseCode(String)
Converts the specified value to an international Morse code representation.
Declaration
public static string ToMorseCode(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The System.String value to convert. |
Returns
| Type | Description |
|---|---|
| System.String | An international Morse code representation of the specified System.String value. |
Remarks
Any characters not supported by the international Morse code specifications is excluded from the result.
ToMorseCode(String, Boolean)
Converts the specified value to an international Morse code representation.
Declaration
public static string ToMorseCode(string value, bool includeUnsupportedCharacters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The System.String value to convert. |
| System.Boolean | includeUnsupportedCharacters | if set to |
Returns
| Type | Description |
|---|---|
| System.String | An international Morse code representation of the specified |
ToPascalCasing(String)
Converts the specified value to a pascal-case representation, using culture-independent casing rules.
Declaration
public static string ToPascalCasing(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The System.String value to convert. |
Returns
| Type | Description |
|---|---|
| System.String | A pascal-case representation of the specified System.String value. |
ToProtocolRelativeUri(Uri)
Converts the specified value of an System.Uri to its equivalent protocol-relative System.String.
Declaration
public static string ToProtocolRelativeUri(Uri value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | value | The System.Uri to be converted. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that is a protocol-relative equivalent to |
ToProtocolRelativeUri(Uri, String)
Converts the specified value of an System.Uri to its equivalent protocol-relative System.String.
Declaration
public static string ToProtocolRelativeUri(Uri value, string relativeReference)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | value | The System.Uri to be converted. |
| System.String | relativeReference | The relative reference to prefix the result with. Default is NetworkPathReference. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that is a protocol-relative equivalent to |
ToUrlEncodedBase64(Byte[])
Encodes a byte array into its equivalent string representation using base 64 digits, which is usable for transmission on the URL.
Declaration
public static string ToUrlEncodedBase64(byte[] value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | value | The byte array to encode. |
Returns
| Type | Description |
|---|---|
| System.String | The string containing the encoded token if the byte array length is greater than one; otherwise, an empty string (""). |