tryAdd

tryAdd(value: MemberType): Boolean lockReceiver, updating;

The tryAdd method of the MemberKeyDictionary class attempts to add the value specified by the value parameter to the member key dictionary if it is not already present. It returns true if the value was successfully added; otherwise it returns false.

Member key dictionaries with a no‑duplicates constraint raise exception 1310 (Key already used in this dictionary) when the collection already contains the member key or keys with a different value, because the tryAdd method is attempting to add a different object that conflicts with an existing entry.

2020.0.01 and higher