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 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()

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