ByteArrayExtensionsToBase64String Method

Converts the given bytes into a Base64 encoded string.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public static string ToBase64String(
	this byte[] bytes,
	int lineLength = 0,
	int indentSize = 0,
	char indentChar = '',
	bool indentSingleLine = false
)

Parameters

bytes  Byte
The bytes to convert.
lineLength  Int32  (Optional)
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. This parameter is optional.
Default value: 0.
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

String
The string representation, in base 64, 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).

Exceptions

See Also