ByteArrayExtensionsToHexValuesString(Byte, String, Int32, Int32, Char, Boolean) Method

Converts the byte array to string of hexadecimal values.


Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.0.0
public static string ToHexValuesString(
	this byte[] bytes,
	string? separator,
	int lineLength,
	int indentSize = 0,
	char indentChar = '',
	bool indentSingleLine = false


bytes  Byte
The byte array to convert.
separator  String
The separator to use between the hex numbers. If or empty, the hex stream will be continuous.
lineLength  Int32
Specifies the length of a line in the result not counting the indentation. When 0 or less, the result will not be wrapped to lines.
indentSize  Int32  (Optional)
Size of the indentation. If greater than zero, the new lines will be prefixed with as many indentChar characters as this parameter specifies. This parameter is optional.
Default value: 0
indentChar  Char  (Optional)
The character to be used for the indentation. This parameter is optional.
Default value: ' ' (space)
indentSingleLine  Boolean  (Optional)
If set to , then a single line result will be indented, too. This parameter is optional.
Default value: .

Return Value

The string representation, in hex, of the contents of bytes.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Byte. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).


ArgumentNullExceptionbytes is
ArgumentExceptionseparator contains hex digits

See Also