Realm Xamarin  v0.75.0
Realm for Xamarin
Public Member Functions | Public Attributes | Properties | List of all members
RealmList< T > Class Template Reference

Used to declare to-many relationships and as the return type when you access such a relationship. More...

Inherits IList< T >.

Public Member Functions

void Add (T item)
 Makes a relationship to an item, appending it at the end of the sorted relationship. More...
 
void Clear ()
 Breaks the relationship to all related items, without deleting the items. More...
 
bool Contains (T item)
 Tests if an item exists in the related set. More...
 
void CopyTo (T[] array, int arrayIndex)
 Copies all the elements to a portion of an array. More...
 
IEnumerator< T > GetEnumerator ()
 Factory for an iterator to be called explicitly or used in a foreach loop. More...
 
int IndexOf (T item)
 Finds an ordinal index for an item in a relationship. More...
 
void Insert (int index, T item)
 Makes a relationship to an item, inserting at a specified location ahead of whatever else was in that location. More...
 
bool Remove (T item)
 Breaks the relationship to the specified item, without deleting the item. More...
 
void RemoveAt (int index)
 Breaks the relationship to the item at the ordinal index, without deleting the item. More...
 

Public Attributes

const int ITEM_NOT_FOUND = -1
 Value returned by IndexOf if an item is not found. More...
 

Properties

int Count [get]
 Returns the count of related items. More...
 
this[int index] [get, set]
 Returns the item at the ordinal index. More...
 

Detailed Description

Used to declare to-many relationships and as the return type when you access such a relationship.

Relationships are ordered and preserve their order, hence the ability to use ordinal indexes in calls such as Insert and RemoveAt.

Template Parameters
TType of the RealmObject which is the target of the relationship.
Type Constraints
T :RealmObject 

Member Function Documentation

void Add ( item)

Makes a relationship to an item, appending it at the end of the sorted relationship.

Parameters
itemRealmObject being added to the relationship.
Template Parameters
TType of the RealmObject which is the target of the relationship.
void Clear ( )

Breaks the relationship to all related items, without deleting the items.

bool Contains ( item)

Tests if an item exists in the related set.

Parameters
itemObject to be searched for in the related items.
Template Parameters
TType of the RealmObject which is the target of the relationship.
Returns
True if found, false if not found.

References RealmList< T >.IndexOf(), and RealmList< T >.ITEM_NOT_FOUND.

void CopyTo ( T[]  array,
int  arrayIndex 
)

Copies all the elements to a portion of an array.

Parameters
indexOrdinal zero-based starting index of the destination of thef related items being copied.
Exceptions
ArgumentNullExceptionThrown if array is null.
ArgumentOutOfRangeExceptionThrown if arrayIndex is less than 0.
ArgumentExceptionThrown if there is not enough room in array from arrayIndex onward.

References RealmList< T >.Count.

IEnumerator<T> GetEnumerator ( )

Factory for an iterator to be called explicitly or used in a foreach loop.

Returns
A RealmListEnumerator as the generic IEnumerator<T>.
int IndexOf ( item)

Finds an ordinal index for an item in a relationship.

Parameters
itemRealmObject being removed from the relationship.
Template Parameters
TType of the RealmObject which is the target of the relationship.
Returns
0-based index if the item was found in the related set, or RealmList.ITEM_NOT_FOUND.

Referenced by RealmList< T >.Contains(), and RealmList< T >.Remove().

void Insert ( int  index,
item 
)

Makes a relationship to an item, inserting at a specified location ahead of whatever else was in that location.

Parameters
indexOrdinal zero-based index at which to insert the related items.
itemRealmObject being inserted into the relationship.
Template Parameters
TType of the RealmObject which is the target of the relationship.
Exceptions
IndexOutOfRangeExceptionWhen the index is out of range for the related items.
bool Remove ( item)

Breaks the relationship to the specified item, without deleting the item.

Parameters
itemRealmObject being removed from the relationship.
Template Parameters
TType of the RealmObject which is the target of the relationship.
Returns
True if the item was found and removed, false if it is not in the related set.

References RealmList< T >.IndexOf(), and RealmList< T >.RemoveAt().

void RemoveAt ( int  index)

Breaks the relationship to the item at the ordinal index, without deleting the item.

Parameters
indexOrdinal zero-based index of the related item.
Exceptions
IndexOutOfRangeExceptionWhen the index is out of range for the related items.

Referenced by RealmList< T >.Remove().

Member Data Documentation

const int ITEM_NOT_FOUND = -1

Value returned by IndexOf if an item is not found.

Referenced by RealmList< T >.Contains().

Property Documentation

int Count
get

Returns the count of related items.

Returns
0 if there are no related items, including a "null" relationship never established, or the count of items.

Referenced by RealmList< T >.CopyTo().

T this[int index]
getset

Returns the item at the ordinal index.

Parameters
indexOrdinal zero-based index of the related items.
Template Parameters
TType of the RealmObject which is the target of the relationship.
Returns
A related item, if exception not thrown.
Exceptions
IndexOutOfRangeExceptionWhen the index is out of range for the related items.