C-Sharp Mapping for Dictionaries
Ice for .NET supports two mappings for dictionaries. By default, a dictionary maps to System.Collections.Generic.Dictionary<T>
. You can use a metadata directive to map a dictionary to System.Collections.Generic.SortedDictionary instead.
On this page:
Default Mapping for Dictionaries in C#
Here is the definition of our EmployeeMap once more:
Slice
dictionary<long, Employee> EmployeeMap;
By default, the Slice-to-C# compiler maps the dictionary to the following type:
C#
System.Collections.Generic.Dictionary<long, Employee>
Custom Mapping for Dictionaries in C#
You can use the "cs:generic:SortedDictionary"
metadata directive to change the default mapping to use a sorted dictionary instead:
Slice
["cs:generic:SortedDictionary"] dictionary<long, Employee> EmployeeMap;
With this definition, the type of the dictionary becomes:
C#
System.Collections.Generic.SortedDictionary<long, Employee>