<cHash>.Merge

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > Data Structures > cHash > cHash Methods >

<cHash>.Merge

 

Description

 

Merge one or more cHash objects.

 

Syntax

 

<cHash>.Merge( cHash1 [, cHash2 [, ...]])

 

Returns

 

None

 

Parameters

 

Name

Type

Optional

Meaning

cHash...



One cHash object





 

Remarks

 

<cHash> will contain its keys and all the keys present in cHash1 + cHash2 + ...

Imported values will replace current values if key name is the same (case insensitive)

 

Restrictions

 

See also

 

Examples

 
Uses "Console"

 
dim lErrorSet1 as new cHash
lErrorSet1.Add(
                 AppConfig_LoadError      :   10,
                 DBConnection_Open_Error  :  110,
                 DBRecordset_Open_Error   : 1120,
               )

 
dim lErrorSet2 as new cHash
lErrorSet2.Add(
                 xxx           :   10,
               )
dim lErrorSet3 as new cHash
lErrorSet3.Add(
                 yyyyyyy       :   20,
               )
 
lErrorSet1.Merge lErrorSet2, lErrorSet3

 
printl "lErrorSet1 after merge:",lErrorSet1.ToString

WaitKey

 

'---Output will be:
' lErrorSet1 after merge: {
'         "XXX": "10",
'         "YYYYYYY": "20",
'         "APPCONFIG_LOADERROR": "10",
'         "DBCONNECTION_OPEN_ERROR": "110",
'         "DBRECORDSET_OPEN_ERROR": "1120"
' }