This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
New shared collection
|
New shared collection {( value {; value2 ; ... ; valueN} )} -> Function result | ||||||||
Parameter | Type | Description | ||||||
value |
![]() |
Shared collection's value(s) | ||||||
Function result | Collection |
![]() |
New shared collection | |||||
The New shared collection command creates a new empty or prefilled shared collection and returns its reference. Adding an element to this collection must be surrounded by the Use...End use structure, otherwise an error is generated. Reading an element without a structure is, however, possible.
Note: For more information on shared collections, please refer to the Shared objects and shared collections page.
If you do not pass any parameters, New shared collection creates an empty shared collection and returns its reference.
You must assign the returned reference to a 4D variable declared with the _O_C_COLLECTION command.
Note: Keep in mind that _O_C_COLLECTION declares a variable of the Collection type, but does not create a collection.
Optionally, you can prefill the new shared collection by passing one or several value(s) as parameter(s). Otherwise, you can add or modify elements subsequently through object notation assignment (see example).
If the new element index is beyond the last existing element of the shared collection, the collection is automatically resized and all new intermediary elements are assigned a null value.
You can pass any number of values of the following supported types:
Note: Unlike standard (not shared) collections, shared collections do not support pictures, pointers, and objects or collections that are not shared.
(*)When a shared object or collection is added to a shared collection, they share the same locking identifier. For more information on this point, refer to the About the locking identifier (how shared groups work) section.
$mySharedCol:=New shared collection("alpha";"omega")
Use($mySharedCol)
$mySharedCol[1]:="beta"
End use
New collection
New shared object
Shared objects and shared collections
Product: 4D
Theme: Collections
Number:
1527
Created: 4D v16 R6
4D Language Reference ( 4D v20 R7)