Could we de-serialize arrays as ArrayList or List<object>?

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      .Net
    • None
    • Major Change
    • None
    • None
    • None
    • None
    • None
    • None

      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.)

            Assignee:
            Sam Corder
            Reporter:
            Andrew Rondeau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: