Android Guides | Samples

Java.Lang.String.GetBytes Method

Returns a new byte array containing the code points in this string encoded using the system's Charset.DefaultCharset.

Syntax

[Android.Runtime.Register("getBytes", "()[B", "")]
public Byte[] GetBytes ()

Remarks

Returns a new byte array containing the code points in this string encoded using the system's Charset.DefaultCharset.

The behavior when this string cannot be represented in the system's default charset is unspecified. In practice, when the default charset is UTF-8 (as it is on Android), all strings can be encoded.

[Android Documentation]

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 9