Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-210

Add ToArray and ToList methods to BsonArray

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.1
    • Affects Version/s: 1.0
    • Component/s: Feature Request
    • Labels:
      None

      It would be nice if BsonArray had ToArray and ToList methods so we could write code like:

      var document = new BsonDocument("array", new BsonArray

      { 1, 2, 3 }

      );
      var list = document["array"].AsBsonArray.ToList<int>();

      instead of:

      var list = document["array"].AsBsonArray.Select(v => v.AsInt32).ToList();

      or something similar if there's a better alternative.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: