/// <summary> /// Finds an ordinal index for an item in a relationship. /// </summary> /// <param name="item">RealmObject being removed from the relationship.</param> /// <returns>0-based index if the item was found in the related set, -1 otherwise.</returns> public int IndexOf(T item) { if (!item.IsManaged) { throw new ArgumentException("Value does not belong to a realm", nameof(item)); } return((int)_listHandle.Find(item.ObjectHandle, IntPtr.Zero)); }
/// <summary> /// Finds an ordinal index for an item in a relationship. /// </summary> /// <param name="item">RealmObject being removed from the relationship.</param> /// <typeparam name="T">Type of the RealmObject which is the target of the relationship.</typeparam> /// <returns>0-based index if the item was found in the related set, or RealmList.ITEM_NOT_FOUND.</returns> public int IndexOf(T item) { if (!item.IsManaged) { throw new ArgumentException("Value does not belong to a realm", nameof(item)); } var rowIndex = ((RealmObject)item).RowHandle.RowIndex; return((int)_listHandle.Find(rowIndex, IntPtr.Zero)); }