xpaulbettsx/Newtonsoft.Json — pull request #1 by justinvp (2013-02-13 04:19:58+00:00)
Title: Return Collection<T> instead of List<T>

Addresses the following from the Framework Design Guidelines, from section 8.3 (starting on page 251 of the second edition):

> **DO NOT** use `ArrayList` or `List` in public APIs.

> **DO NOT** provide settable collection properties.

> **DO** use `Collection` or a subclass of `Collection` for properties or return values representing read/write collections.

> **DO NOT** return null values from collection properties or from methods returning collections. Return an empty collection or an empty array instead.

The public API surface returns `Collection` but internally it is an instance of the private `JsonContractMethodCollection` class which is mainly used as an optimization for getting the actual `List` for faster enumeration (though, I doubt this matters much in practice... and could be removed for simpler code).

These changes shouldn't be any less performant than using `List` directly, other than the cost of the extra allocation for the `Collection` wrapper.