Click or drag to resize

ExtensionsTryEncode Method

Tries to encode a byte array to a string by detecting its encoding.

It will try to detect the encoding for for UTF-7, UTF-8/16/32 (bom, no bom, little and big endian), and local default codepage, and potentially other codepages.

Namespace:  Cauldron
Assembly:  Cauldron (in Cauldron.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static string TryEncode(
	this byte[] data
)

Parameters

data
Type: SystemByte
The byte array that contains the string to be encoded

Return Value

Type: String
The encoded string

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . 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).
Examples
var text = Assemblies.GetManifestResource("embedded-text.txt").TryEncode();
See Also