Brecham.Obex — An OBEX library for the .NET Framework

ObexHeaderConverter.StringAsAsciiByteSeq Method 

Converts a String into a Byte array containing ASCII encoded text, to be carried in a byte sequence header type.

[Visual Basic]
Public Shared Function StringAsAsciiByteSeq( _
   ByVal value As String, _
   ByVal nullTerminate As Boolean _
) As Byte()
[C#]
public static byte[] StringAsAsciiByteSeq(
   string value,
   bool nullTerminate
);

Parameters

value
The String to be converted.
nullTerminate
Whether to add a null terminator byte to the byte array. The Type header has null-termination, but the Time header has not, for instance.

Return Value

A Byte array in the requested format.

Remarks

The conversion is a strict conversion where the platform supports EncoderFallback, i.e. not on CF or FXv1.1.

Exceptions

Exception Type Condition
EncoderFallbackException The given string is not in ASCII format.

See Also

ObexHeaderConverter Class | Brecham.Obex Namespace | StringFromAsciiByteSeq