ToDictionary¶
Returns a DataTableDictionary indexed by the specified columns for fast access.
1 | |
Parameters¶
string columns
A comma-separated or semicolon-separated list of the key columns. Required.
string separator optional
The separator between column values when several columns are specified. Defaults to ..
Returns¶
A DataTableDictionary instance.
Remarks¶
An error is thrown when a column does not exist in the table.
Keys are compared case-insensitively. If several rows share a key, the dictionary returns an array of rows for that key. When a key contains no . character, leading zeroes are removed; to keep significant leading zeroes, use a key format that contains a . character.
Use a dictionary instead of querying the database inside a loop.
Examples¶
Index rows by a column¶
1 2 3 4 5 6 7 8 9 10 11 | |
Index rows by several columns¶
1 2 3 4 5 6 | |