Skip to content

Supporting IEnumerable of T based types

Stefan edited this page Dec 16, 2018 · 2 revisions

Serialization will simply use the Enumerator. Deserialization is a bit more complicated:

  • ISet<T> will use HashSet<T>
  • IDictionary<TKey, TValue>/IReadOnlyDictionary<TKey, TValue> will use Dictionary<TKey, TValue>
  • IList<T> will use List<T>
  • IEnumerable<T> will use T[]

Deserialization of types implementing IEnumerable<T> is supported as long they have a public constructor with a single IEnumerable<T> parameter.

Stack<T> and ConcurrentStack<T> are not supported as it would require reversing the input prior to creating the type for deserialization.

Clone this wiki locally