Share via


SelectionKey.Attach(Object) Method

Definition

Attaches the given object to this key.

[Android.Runtime.Register("attach", "(Ljava/lang/Object;)Ljava/lang/Object;", "")]
public Java.Lang.Object? Attach (Java.Lang.Object? ob);
[<Android.Runtime.Register("attach", "(Ljava/lang/Object;)Ljava/lang/Object;", "")>]
member this.Attach : Java.Lang.Object -> Java.Lang.Object

Parameters

ob
Object

The object to be attached; may be null

Returns

The previously-attached object, if any, otherwise null

Attributes

Remarks

Attaches the given object to this key.

An attached object may later be retrieved via the #attachment() attachment method. Only one object may be attached at a time; invoking this method causes any previous attachment to be discarded. The current attachment may be discarded by attaching null.

Java documentation for java.nio.channels.SelectionKey.attach(java.lang.Object).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to