[CSHARP-1077] Support deserialization of readonly collection interfaces (IReadOnlyCollection<T>, IReadOnlyLis<T>t) Created: 23/Sep/14 Updated: 08/Apr/15 Resolved: 08/Apr/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | 1.9.2 |
| Fix Version/s: | 2.0 |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Bar Arnon | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
The driver does support serialization of these types, as they extend IEnumerable<T>, but it doesn't support deserialization. It's unfortunate as these types are the only option for properties that are both readonly (as IEnumerable<T> is) and imply they are already materialized (which IEnumerable<T> isn't). |
| Comments |
| Comment by Robert Stam [ 08/Apr/15 ] | ||||||
|
This is now supported in the 2.0 version of the driver. The following class can be successfully serialized and deserialized:
And the serialized form looks like this:
| ||||||
| Comment by Craig Wilson [ 30/Sep/14 ] | ||||||
|
Thanks for the report. We have not been compiling for .NET 4 or .NET 4.5 in our 1.x branch and as such don't have access to these types. However, our next major version, 2.0, will be targetting .NET 4.5. We certainly should include support for these types. We are using them heavily in the actual driver code and know their benefits. |