Click or drag to resize
GtmPropertiesMergerMerge Method

Merges gtmData and additionalData to form new GtmData.

If additionalData can be enumerated as KeyValuePairTKey, TValue items, then the key-value pairs are merged. Otherwise, the public properties and their values are merged.

Namespace: CMS.Ecommerce
Assembly: CMS.Ecommerce (in CMS.Ecommerce.dll) Version: 13.0.131
Syntax
C#
public static GtmData Merge(
	GtmData gtmData,
	Object additionalData,
	bool overwrite = false
)

Parameters

gtmData
Type: CMS.EcommerceGtmData
Source object to be merged with additionalData object.
additionalData
Type: SystemObject
Properties of this object are merged with gtmData object.
overwrite (Optional)
Type: SystemBoolean
Decides whether values of properties with the same name are substituted for values of additionalData object.

Return Value

Type: GtmData
New GtmData with combined properties and values of original gtmData and additionalData.
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown when gtmData is null.
InvalidOperationExceptionThrown when additionalData can be enumerated as KeyValuePairTKey, TValue items, but a null key is found.
Remarks
Objects properties are merged only on the first level.
Examples

Source object: new GtmData { a = 1, b = 2 }

Merge object: new { a = 3, c = 4 }

Rewrite equals false: new GtmData { a = 1, b = 2, c = 4 }

Rewrite equals false: new GtmData { a = 3, b = 2, c = 4 }

See Also