Collections
Supported types
Arrays and lists:
T[]
List<T>
IEnumerable<T>
(backed byT[]
)IReadOnlyList<T>
(backed byT[]
)IReadOnlyCollection<T>
(backed byT[]
)ICollection<T>
(backed byList<T>
)IList<T>
(backed byList<T>
)
Dictionaries:
Dictionary<TKey, TValue>
IDictionary<TKey, TValue>
(backed byDictionary
)IReadOnlyDictionary<TKey, TValue>
(backed byDictionary
)
Sets:
HashSet<T>
ISet<T>
(backed byHashSet
)
Collections can have classes, structs and other collections as elements.
Binder requirements
Collections require binders defined for element types (both keys and values in case of dictionaries).
Node requirements
Array or object node. Empty nodes are converted to empty collections.
Null node handling
An empty collection is returned unless explictly required.
Nulls are not valid as dictionary keys.
Error handling
Any element binding failure results in complete collection binding failure.
Comparer customization
A custom element comparer (such as StringComparer.OrdinalIgnoreCase
for case-insensitive dictionary keys) can be achieved by wrapping the collection in a custom type and utilizing the constructor binding convention.
Related pages
Last updated