Edit

Share via


BerConverter.Encode(String, Object[]) Method

Definition

The Encode(String, Object[]) method encodes structured data, using BER, to retrieve a binary representation of the data.

public static byte[] Encode(string format, params object[] value);

Parameters

format
String

The format string.

value
Object[]

An array of formatted data.

Returns

Byte[]

An array of BER-encoded data.

Remarks

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}}.

Exceptions

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.

Applies to

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)