Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Encode(String, Object[]) method encodes structured data, using BER, to retrieve a binary representation of the data.
public:
static cli::array <System::Byte> ^ Encode(System::String ^ format, ... cli::array <System::Object ^> ^ value);
public static byte[] Encode(string format, params object[] value);
static member Encode : string * obj[] -> byte[]
Public Shared Function Encode (format As String, ParamArray value As Object()) As Byte()
The format string.
An array of formatted data.
An array of BER-encoded data.
The following are valid format characters.
Encoding rules:
Code | Corresponding Argument |
---|---|
'{' '}' '[' ']' 'n' | No corresponding argument |
't' 'i' 'e' | int |
'a' | Octet string |
'b' | bool |
's' | string |
'o' 'X' | byte[] |
'v' | string[] |
'V' | byte[][] |
Note
'v' and 'V' are special in that a double {} is required. For example, use {{v}} and {{V}}.
Exception | Condition |
---|---|
ArgumentNullException | format is a null reference (Nothing in Visual Basic). |
ArgumentException | This exception occurs in any one of the following conditions: - There are not enough arguments for the format string. - The format string argument is incorrect. - The format string contains an undefined character. |
BerConversionException | Error processing return value. |
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in