Skip to content

Set

Adds an entry with the specified key and rows to the dictionary.

1
myDataTableDictionary.Set(key: string, value: ( DataRow | Array<DataRow> )):DataTableDictionary

Parameters

string key
    The key of the entry. Required.

( DataRow | Array<DataRow> ) value
    A row or an array of rows.

Returns

The current DataTableDictionary instance.

Remarks

This method only changes the dictionary; it does not add rows to the DataTable. If the key already exists, the existing entry is kept. Use DataTableDictionary.Ensure to insert or update rows.

Examples

Add an alias key for an existing row

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
var groupsByName = $Database.Get({
    TargetSchema : 'HR',
    TargetTable : 'Groups'
}).ToDictionary('Name');

var administrators = groupsByName.Get('Administrators');

if (administrators) {
    groupsByName.Set('Admins', administrators);
}

See Also