Mono Class Library: System.Text.UTF8Encoding Overview | Members

System.Text.UTF8Encoding.GetBytes Method

Encodes the specified string as a System.Text.UTF8Encoding.

public override byte[] GetBytes (string s)

Parameters

s
The string to encode as a System.Text.UTF8Encoding.

Returns

A byte array containing the values encoded from s as a System.Text.UTF8Encoding.

Exceptions

TypeReason
ArgumentExceptionError-checking is turned on for the current instance and s contains an invalid surrogate sequence.
ArgumentNullExceptions is null.

Remarks

If error-checking is turned off and an invalid surrogate sequence is detected, the invalid characters are ignored and are not encoded into the returned byte array, and no exception is thrown.

Note: This method overrides Encoding.GetBytes(Char[]).

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0