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

Remove superfluous Create methods and change how remaining Create methods handle C# null

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0
    • Affects Version/s: 1.8
    • Component/s: None
    • None

      [Original description]

      var value = BsonBoolean.Create("false");

      value.RawValue == true

      ?!!!

      [Edited description]

      The BsonDocument object model has many Create methods that are not strictly required. We are going to do some cleaning up and remove them. There are explicit conversions that do exactly the same thing.

      We are leaving the Create methods that take an object parameter, because in that case the user can't call a constructor, because the required BsonValue subclass isn't known at compile time.

      We are also changing how the remaining Create methods handle C# null. They will now throw an ArgumentNullException if the value is C# null, with the exception of BsonValue.Create which will map C# null to BsonNull.Value.

      We are also changing the Add methods to throw ArgumentNullException if callled with a C# null argument (they used to treat C# null as a no-op).

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

              Created:
              Updated:
              Resolved: