[This is preliminary documentation and is subject to change.]
C# |
public void Remove( Object obj )
- obj (Object)
- The object to remove from the list.
This works slightly differently, depending on whether or not the collection is ordered. In ordered collections, objects in the list are always found at the position specified by their Order property. For ordered lists, a check is made that the supplied object is in fact in the list at the position given by its order field. If it is, then the Order property in all subsequent objects in the collection is decremented by 1.
For non-ordered lists, no check is made that the object is or is not in the list. If it is, it is removed. If it is not, no exception is thrown.
NB: There is a special case for many type collections. Even though the object is not currently in this list in memory, so long as the parent and class of the object are the same as this collection, it is still removed from the persistent tree. In this case, false is returned.
If the object to remove is a Choice object and this is a contained Choice collection created in generated code, then the Target of the Choice is the object which is deleted from persistent storage. This is what allows you to delete objects from the grid in lookup forms.
Exception | Condition |
---|---|
ArgumentNullException | Supplied object is
null. |
ArgumentException | Supplied object was not in an ordered
list at the position given by its Order property. |
InvalidCastException | Thrown if the supplied object is not
of type T. |