Sdílet prostřednictvím


IList.Add Method

Definition

Overloads

Add(Object)

Appends the specified element to the end of this list (optional operation).

Add(Int32, Object)

Inserts the specified element at the specified position in this list (optional operation).

Add(Object)

Appends the specified element to the end of this list (optional operation).

[Android.Runtime.Register("add", "(Ljava/lang/Object;)Z", "GetAdd_Ljava_lang_Object_Handler:Java.Util.IListInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool Add (Java.Lang.Object? e);
[<Android.Runtime.Register("add", "(Ljava/lang/Object;)Z", "GetAdd_Ljava_lang_Object_Handler:Java.Util.IListInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Add : Java.Lang.Object -> bool

Parameters

e
Object

element to be appended to this list

Returns

true (as specified by Collection#add)

Implements

Attributes

Remarks

Appends the specified element to the end of this list (optional operation).

Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.

Java documentation for java.util.List.add(E).

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

Add(Int32, Object)

Inserts the specified element at the specified position in this list (optional operation).

[Android.Runtime.Register("add", "(ILjava/lang/Object;)V", "GetAdd_ILjava_lang_Object_Handler:Java.Util.IListInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void Add (int index, Java.Lang.Object? element);
[<Android.Runtime.Register("add", "(ILjava/lang/Object;)V", "GetAdd_ILjava_lang_Object_Handler:Java.Util.IListInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Add : int * Java.Lang.Object -> unit

Parameters

index
Int32

index at which the specified element is to be inserted

element
Object

element to be inserted

Attributes

Remarks

Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Java documentation for java.util.List.add(int, E).

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