[CSHARP-23] Could we de-serialize arrays as ArrayList or List<object>? Created: 04/Mar/10 Updated: 12/Mar/10 Resolved: 12/Mar/10 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Andrew Rondeau | Assignee: | Sam Corder |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
.Net |
||
| Backwards Compatibility: | Major Change |
| Description |
|
Could we de-serialize arrays as ArrayList or List? In Javascript, an "Array" behaves like a .Net ArrayList or List. Furthermore, the behavior of deserialization is somewhat non-deterministic as the programmer can really only count on getting an IEnumerable as opposed to a working collection. This is especially the case with mixed types, where the programmer would usually get an object[], but might get an int[] or string[]. This would be a breaking change, but it would be worth it. ------------ A potential way to do it is (in BsonReader.cs): private Object ConvertToArray (Document doc) { List<object> ret = new List<object>(); foreach (String key in doc.Keys) ret.Add(doc[key]); return ret; }-------------- (Note: I'm trying to keep my local branch as close as possible to the master, so I'm keeping this out of my local branch.) |
| Comments |
| Comment by Sam Corder [ 12/Mar/10 ] |
|
Commited fix to the pool branch. It will be in the next release coming shortly. |